[devel] Initialize row_pointers to NULL with a loop
instead of memset to zero in png_read_png().
This commit is contained in:
parent
0af5378d4d
commit
d9f21ee796
2
ANNOUNCE
2
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.
|
||||
|
2
CHANGES
2
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
|
||||
|
13
pngread.c
13
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; 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));
|
||||
|
Loading…
Reference in New Issue
Block a user