Leaking CGBitmapContext in SkFontHost_mac
authorljagielski <ljagielski@opera.com>
Wed, 16 Jul 2014 03:02:04 +0000 (20:02 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 16 Jul 2014 03:02:04 +0000 (20:02 -0700)
third_party/skia/src/ports/SkFontHost_mac.cpp: don't increase retain count of
newly assigned CFTypeRef in AutoCFRelease::reset(). Each time CFTypeRef is
assigned to AutoCFRelease, AutoCFRelease becomes its sole owner.

BUG=skia:
R=reed@google.com, bungeman@google.com, rmistry@google.com, sheyang@chromium.org

Author: ljagielski@opera.com

Review URL: https://codereview.chromium.org/393513003

src/ports/SkFontHost_mac.cpp

index 21a2b95..7f3a3c1 100755 (executable)
@@ -82,9 +82,10 @@ public:
     ~AutoCFRelease() { CFSafeRelease(fCFRef); }
 
     void reset(CFRef that = NULL) {
-        CFSafeRetain(that);
-        CFSafeRelease(fCFRef);
-        fCFRef = that;
+        if (that != fCFRef) {
+            CFSafeRelease(fCFRef);
+            fCFRef = that;
+        }
     }
 
     AutoCFRelease& operator =(CFRef that) {