Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Unified Diff: src/core/SkScaledImageCache.cpp

Issue 107443009: Address memory leak in SkScaledImageCache (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Added comment Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkScaledImageCache.cpp
===================================================================
--- src/core/SkScaledImageCache.cpp (revision 12743)
+++ src/core/SkScaledImageCache.cpp (working copy)
@@ -428,7 +428,10 @@
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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698