diff --git a/ANNOUNCE b/ANNOUNCE index 309897f5c..a0da7bab1 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -537,6 +537,8 @@ version 1.4.0beta77 [August 27, 2009] version 1.4.0beta78 [August 31, 2009] Converted all PNG_NO_* tests to PNG_*_SUPPORTED everywhere except pngconf.h Eliminated PNG_NO_FREE_ME and PNG_FREE_ME_SUPPORTED macros. + Use a loop instead of png_memset() to initialize row_pointers in + png_read_png(). version 1.4.0betaN [future] Build shared libraries with -lz and sometimes -lm. diff --git a/CHANGES b/CHANGES index 3d5cc1eb2..d41b733a8 100644 --- a/CHANGES +++ b/CHANGES @@ -2219,6 +2219,8 @@ version 1.4.0beta77 [August 27, 2009] and the "noconfig" files from the distribution. Moved CMakeLists.txt from scripts into the main libpng directory. Various bugfixes and improvements to CMakeLists.txt (Philip Lowman) + Use a loop instead of png_memset() to initialize row_pointers in + png_read_png(). version 1.4.0beta78 [August 31, 2009] Converted all PNG_NO_* tests to PNG_*_SUPPORTED everywhere except pngconf.h diff --git a/pngread.c b/pngread.c index 86399e5e6..9e3ae4bfb 100644 --- a/pngread.c +++ b/pngread.c @@ -1317,16 +1317,15 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0); if (info_ptr->row_pointers == NULL) { -#ifdef PNG_CALLOC_SUPPORTED - info_ptr->row_pointers = (png_bytepp)png_calloc(png_ptr, - info_ptr->height * png_sizeof(png_bytep)); -#else + png_uint_32 iptr; + info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr, info_ptr->height * png_sizeof(png_bytep)); - png_memset(info_ptr->row_pointers, 0, info_ptr->height - * png_sizeof(png_bytep)); -#endif + for (iptr=0; iptrheight; iptr++) + info_ptr->row_pointers[iptr] = NULL; + info_ptr->free_me |= PNG_FREE_ROWS; + for (row = 0; row < (int)info_ptr->height; row++) info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));