aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-12 15:30:06 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-11-12 15:30:06 +0000
commit5401cd019b5a355bdc20f0846e50a641f45e03c2 (patch)
treed66de5aa9fa7094bc0526448a5ea7ece582c19cf
parentf4dcea602074cad88346d98535b7b80a419af807 (diff)
Clean up after longjmp in SkImageDecoder_libpng.
In onDecodeInit, if longjmp sends us back to setjmp, destroy the png_struct and info_ptr before returning false. Since the PNGAutoClean has not been created yet, we were previously leaking resources. R=djsollen@google.com Review URL: https://codereview.chromium.org/68453006 git-svn-id: http://skia.googlecode.com/svn/trunk@12244 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/images/SkImageDecoder_libpng.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index b51ffb9ea3..02ba6af90a 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -255,6 +255,7 @@ bool SkPNGImageDecoder::onDecodeInit(SkStream* sk_stream, png_structp *png_ptrp,
* set up your own error handlers in the png_create_read_struct() earlier.
*/
if (setjmp(png_jmpbuf(png_ptr))) {
+ png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
return false;
}