Index: src/images/SkImageDecoder_libpng.cpp |
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp |
index f9ef6b7942306016c714668555d96b7c3c31fbb3..c074268cffbc996ef1b0f01765402f806504ba8c 100644 |
--- a/src/images/SkImageDecoder_libpng.cpp |
+++ b/src/images/SkImageDecoder_libpng.cpp |
@@ -362,6 +362,12 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap |
SkAutoLockPixels alp(*decodedBitmap); |
+ // Repeat setjmp, otherwise variables declared since the last call (e.g. alp |
+ // and aur) won't get their destructors called in case of a failure. |
+ if (setjmp(png_jmpbuf(png_ptr))) { |
+ return kFailure; |
+ } |
+ |
/* Turn on interlace handling. REQUIRED if you are not using |
* png_read_image(). To see how to handle interlacing passes, |
* see the png_read_row() method below: |