Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: src/codec/SkCodec_libpng.cpp

Issue 1058873006: Get rid of leaks in SkCodec::NewFromStream. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment that ReadHeader does not own SkStream. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkCodec_libgif.cpp ('k') | src/codec/SkCodec_wbmp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/codec/SkCodec_libgif.cpp ('k') | src/codec/SkCodec_wbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698