Leaking CGBitmapContext in SkFontHost_mac
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
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 21a2b95..7f3a3c1 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -82,9 +82,10 @@
~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) {