Index: src/codec/SkCodec_libpng.cpp |
diff --git a/src/codec/SkCodec_libpng.cpp b/src/codec/SkCodec_libpng.cpp |
index 33111cee67841938335fd6f7b0862d5f9ec0a9c6..121b74ff0b3a97defc00a75ed5c2c1cabda5b2e4 100644 |
--- a/src/codec/SkCodec_libpng.cpp |
+++ b/src/codec/SkCodec_libpng.cpp |
@@ -346,11 +346,12 @@ static bool read_header(SkStream* stream, png_structp* png_ptrp, |
} |
SkCodec* SkPngCodec::NewFromStream(SkStream* stream) { |
+ SkAutoTDelete<SkStream> streamDeleter(stream); |
png_structp png_ptr; |
png_infop info_ptr; |
SkImageInfo imageInfo; |
if (read_header(stream, &png_ptr, &info_ptr, &imageInfo)) { |
- return SkNEW_ARGS(SkPngCodec, (imageInfo, stream, png_ptr, info_ptr)); |
+ return SkNEW_ARGS(SkPngCodec, (imageInfo, streamDeleter.detach(), png_ptr, info_ptr)); |
} |
return NULL; |
} |