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
This commit is contained in:
scroggo@google.com 2013-11-12 15:30:06 +00:00
parent f4dcea6020
commit 5401cd019b

View File

@ -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. * set up your own error handlers in the png_create_read_struct() earlier.
*/ */
if (setjmp(png_jmpbuf(png_ptr))) { if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
return false; return false;
} }