[devel] Initialize row_pointers to NULL with a loop

instead of memset to zero in png_read_png().
This commit is contained in:
Glenn Randers-Pehrson 2009-08-31 10:52:38 -05:00
parent 0af5378d4d
commit d9f21ee796
3 changed files with 10 additions and 7 deletions

View File

@ -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.

View File

@ -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

View File

@ -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; iptr<info_ptr->height; 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));