Fix leak of SkImageGenerator
authormsarett <msarett@google.com>
Mon, 25 Jan 2016 18:51:29 +0000 (10:51 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 25 Jan 2016 18:51:29 +0000 (10:51 -0800)
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1638463002

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

dm/DMSrcSink.cpp

index 057b6ae480c857460fa81683211eea349e6eaae3..5b20e3959fbb0dcb95148c088868cc2cd09c8cb6 100644 (file)
@@ -279,7 +279,7 @@ bool get_decode_info(SkImageInfo* decodeInfo, const SkImageInfo& defaultInfo,
 }
 
 Error test_gen(SkCanvas* canvas, SkData* data) {
-    SkImageGenerator* gen = SkCodecImageGenerator::NewFromEncodedCodec(data);
+    SkAutoTDelete<SkImageGenerator> gen = SkCodecImageGenerator::NewFromEncodedCodec(data);
     if (!gen) {
         return "Could not create image generator.";
     }
@@ -293,7 +293,7 @@ Error test_gen(SkCanvas* canvas, SkData* data) {
         return Error::Nonfatal("Skip testing non-opaque images to 565.");
     }
 
-    SkAutoTDelete<SkImage> image(SkImage::NewFromGenerator(gen, nullptr));
+    SkAutoTDelete<SkImage> image(SkImage::NewFromGenerator(gen.detach(), nullptr));
     if (!image) {
         return "Could not create image from codec image generator.";
     }