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); |
} |