From 8e46375186eb95d30d93bc3160861bb7ba99a0c7 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 2 Nov 2009 06:04:47 -0600 Subject: [PATCH] [master] Free png_ptr->user_png_ver when destroying png_ptr. --- ANNOUNCE | 1 + CHANGES | 1 + pngread.c | 5 +++++ pngwrite.c | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/ANNOUNCE b/ANNOUNCE index fda61ba7..68fdbbda 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -107,6 +107,7 @@ version 1.2.41beta11 [November 2, 2009] library mismatch. version 1.2.41beta12 [November 2, 2009] + Free png_ptr->user_png_ver when destroying png_ptr. Send comments/corrections/commendations to png-mng-implement at lists.sf.net diff --git a/CHANGES b/CHANGES index 0a58675a..ee126e0a 100644 --- a/CHANGES +++ b/CHANGES @@ -2537,6 +2537,7 @@ version 1.2.41beta11 [November 2, 2009] library mismatch. version 1.2.41beta12 [November 2, 2009] + Free png_ptr->user_png_ver when destroying png_ptr. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngread.c b/pngread.c index c836e01a..9e58f47e 100644 --- a/pngread.c +++ b/pngread.c @@ -1326,6 +1326,11 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr #endif /* PNG_TEXT_SUPPORTED */ #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ +/* New member added in libpng-1.2.41, will be removed from 1.4.0 */ +#ifdef PNG_iTXt_SUPPORTED + png_free(png_ptr, png_ptr->user_png_ver); +#endif + /* Save the important info out of the png_struct, in case it is * being used again. */ diff --git a/pngwrite.c b/pngwrite.c index e08e960c..991aa914 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -1179,6 +1179,11 @@ png_write_destroy(png_structp png_ptr) free_fn = png_ptr->free_fn; #endif +/* New member added in libpng-1.2.41, will be removed from 1.4.0 */ +#ifdef PNG_iTXt_SUPPORTED + png_free(png_ptr, png_ptr->user_png_ver); +#endif + png_memset(png_ptr, 0, png_sizeof(png_struct)); png_ptr->error_fn = error_fn;