From b49a578135c0a7eff9cf6dd0b1c6a46d49ac2feb Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 16 Jan 2015 15:39:24 -0800 Subject: [PATCH] dwebp/WritePNG: mark png variables volatile these are used on both sides of the setjmp(). (cherry picked from commit 7a191398caa4847c4eeba4375f2886e7377b1655) Change-Id: I4a789bfb3a5d56946a22286c5a140008d90e1ba2 --- examples/dwebp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/dwebp.c b/examples/dwebp.c index 45f77dda..bda9304f 100644 --- a/examples/dwebp.c +++ b/examples/dwebp.c @@ -193,8 +193,8 @@ static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) { uint8_t* const rgb = buffer->u.RGBA.rgba; const int stride = buffer->u.RGBA.stride; const int has_alpha = (buffer->colorspace == MODE_RGBA); - png_structp png; - png_infop info; + volatile png_structp png; + volatile png_infop info; png_uint_32 y; png = png_create_write_struct(PNG_LIBPNG_VER_STRING, @@ -204,11 +204,11 @@ static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) { } info = png_create_info_struct(png); if (info == NULL) { - png_destroy_write_struct(&png, NULL); + png_destroy_write_struct((png_structpp)&png, NULL); return 0; } if (setjmp(png_jmpbuf(png))) { - png_destroy_write_struct(&png, &info); + png_destroy_write_struct((png_structpp)&png, (png_infopp)&info); return 0; } png_init_io(png, out_file); @@ -222,7 +222,7 @@ static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) { png_write_rows(png, &row, 1); } png_write_end(png, info); - png_destroy_write_struct(&png, &info); + png_destroy_write_struct((png_structpp)&png, (png_infopp)&info); return 1; } #else // !HAVE_WINCODEC_H && !WEBP_HAVE_PNG