Address memory leak in SkScaledImageCache

https://codereview.chromium.org/107443009/



git-svn-id: http://skia.googlecode.com/svn/trunk@12749 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2013-12-18 18:48:08 +00:00
parent 1ad518bf38
commit 5db04dfad7

View File

@ -428,7 +428,10 @@ SkScaledImageCache::ID* SkScaledImageCache::addAndLock(SkScaledImageCache::Rec*
SkASSERT(rec);
// See if we already have this key (racy inserts, etc.)
Rec* existing = this->findAndLock(rec->fKey);
if (existing != NULL) {
if (NULL != existing) {
// Since we already have a matching entry, just delete the new one and return.
// Call sites cannot assume the passed in object will live past this call.
SkDELETE(rec);
return rec_to_id(existing);
}