Fix memory leak in gammatext GM.
authorscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 1 Aug 2012 20:53:33 +0000 (20:53 +0000)
committerscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 1 Aug 2012 20:53:33 +0000 (20:53 +0000)
Review URL: https://codereview.appspot.com/6458055

git-svn-id: http://skia.googlecode.com/svn/trunk@4902 2bbb7eff-a529-9590-31e7-b0007b416f81

gm/gammatext.cpp

index bbd2409..3e3163c 100644 (file)
@@ -47,7 +47,7 @@ static CGContextRef makeCG(const SkBitmap& bm) {
     CGContextRef cg = CGBitmapContextCreate(bm.getPixels(), bm.width(), bm.height(),
                                             8, bm.rowBytes(), space, BITMAP_INFO_RGB);
     CFRelease(space);
-    
+
     CGContextSetAllowsFontSubpixelQuantization(cg, false);
     CGContextSetShouldSubpixelQuantizeFonts(cg, false);
     
@@ -185,6 +185,9 @@ protected:
             }
             x += SkIntToScalar(1024) / SK_ARRAY_COUNT(fg);
         }
+#ifdef SK_BUILD_FOR_MAC
+        CGContextRelease(cg);
+#endif
     }
 
 private: