[libpng16] Added missing "ptr = NULL" after some instances of png_free().
This commit is contained in:
parent
7f6826368a
commit
c6a8cb7d10
5
ANNOUNCE
5
ANNOUNCE
@ -1,4 +1,4 @@
|
|||||||
Libpng 1.6.15beta01 - October 27, 2014
|
Libpng 1.6.15beta01 - October 29, 2014
|
||||||
|
|
||||||
This is not intended to be a public release. It will be replaced
|
This is not intended to be a public release. It will be replaced
|
||||||
within a few weeks by a public version or by another test version.
|
within a few weeks by a public version or by another test version.
|
||||||
@ -25,9 +25,10 @@ Other information:
|
|||||||
|
|
||||||
Changes since the last public release (1.6.14):
|
Changes since the last public release (1.6.14):
|
||||||
|
|
||||||
Version 1.6.15beta01 [October 27, 2014]
|
Version 1.6.15beta01 [October 29, 2014]
|
||||||
Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x !== 0)"
|
Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x !== 0)"
|
||||||
Simplified png_free_data().
|
Simplified png_free_data().
|
||||||
|
Added missing "ptr = NULL" after some instances of png_free().
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
4
png.c
4
png.c
@ -768,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||||||
#else
|
#else
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.15beta01 - October 27, 2014" PNG_STRING_NEWLINE \
|
"libpng version 1.6.15beta01 - October 29, 2014" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE;
|
PNG_STRING_NEWLINE;
|
||||||
# else
|
# else
|
||||||
return "libpng version 1.6.15beta01 - October 27, 2014\
|
return "libpng version 1.6.15beta01 - October 29, 2014\
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.14 [October 23, 2014]
|
* Last changed in libpng 1.6.15 [(PENDING RELEASE)]
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -584,11 +584,13 @@ png_push_save_buffer(png_structrp png_ptr)
|
|||||||
if (png_ptr->save_buffer == NULL)
|
if (png_ptr->save_buffer == NULL)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, old_buffer);
|
png_free(png_ptr, old_buffer);
|
||||||
|
old_buffer = NULL;
|
||||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||||
png_free(png_ptr, old_buffer);
|
png_free(png_ptr, old_buffer);
|
||||||
|
old_buffer = NULL;
|
||||||
png_ptr->save_buffer_max = new_max;
|
png_ptr->save_buffer_max = new_max;
|
||||||
}
|
}
|
||||||
if (png_ptr->current_buffer_size)
|
if (png_ptr->current_buffer_size)
|
||||||
|
16
pngread.c
16
pngread.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.11 [June 5, 2014]
|
* Last changed in libpng 1.6.15 [(PENDING RELEASE)]
|
||||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -922,22 +922,33 @@ png_read_destroy(png_structrp png_ptr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_free(png_ptr, png_ptr->big_row_buf);
|
png_free(png_ptr, png_ptr->big_row_buf);
|
||||||
|
png_ptr->big_row_buf = NULL;
|
||||||
png_free(png_ptr, png_ptr->big_prev_row);
|
png_free(png_ptr, png_ptr->big_prev_row);
|
||||||
|
png_ptr->big_prev_row = NULL;
|
||||||
png_free(png_ptr, png_ptr->read_buffer);
|
png_free(png_ptr, png_ptr->read_buffer);
|
||||||
|
png_ptr->read_buffer = NULL;
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||||
png_free(png_ptr, png_ptr->palette_lookup);
|
png_free(png_ptr, png_ptr->palette_lookup);
|
||||||
|
png_ptr->palette_lookup = NULL;
|
||||||
png_free(png_ptr, png_ptr->quantize_index);
|
png_free(png_ptr, png_ptr->quantize_index);
|
||||||
|
png_ptr->quantize_index = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (png_ptr->free_me & PNG_FREE_PLTE)
|
if (png_ptr->free_me & PNG_FREE_PLTE)
|
||||||
|
{
|
||||||
png_zfree(png_ptr, png_ptr->palette);
|
png_zfree(png_ptr, png_ptr->palette);
|
||||||
|
png_ptr->palette = NULL;
|
||||||
|
}
|
||||||
png_ptr->free_me &= ~PNG_FREE_PLTE;
|
png_ptr->free_me &= ~PNG_FREE_PLTE;
|
||||||
|
|
||||||
#if defined(PNG_tRNS_SUPPORTED) || \
|
#if defined(PNG_tRNS_SUPPORTED) || \
|
||||||
defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||||
if (png_ptr->free_me & PNG_FREE_TRNS)
|
if (png_ptr->free_me & PNG_FREE_TRNS)
|
||||||
|
{
|
||||||
png_free(png_ptr, png_ptr->trans_alpha);
|
png_free(png_ptr, png_ptr->trans_alpha);
|
||||||
|
png_ptr->trans_alpha = NULL;
|
||||||
|
}
|
||||||
png_ptr->free_me &= ~PNG_FREE_TRNS;
|
png_ptr->free_me &= ~PNG_FREE_TRNS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -945,15 +956,18 @@ png_read_destroy(png_structrp png_ptr)
|
|||||||
|
|
||||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||||
png_free(png_ptr, png_ptr->save_buffer);
|
png_free(png_ptr, png_ptr->save_buffer);
|
||||||
|
png_ptr->save_buffer = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) && \
|
#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) && \
|
||||||
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
png_free(png_ptr, png_ptr->unknown_chunk.data);
|
||||||
|
png_ptr->unknown_chunk.data = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
png_free(png_ptr, png_ptr->chunk_list);
|
png_free(png_ptr, png_ptr->chunk_list);
|
||||||
|
png_ptr->chunk_list = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* NOTE: the 'setjmp' buffer may still be allocated and the memory and error
|
/* NOTE: the 'setjmp' buffer may still be allocated and the memory and error
|
||||||
|
@ -670,6 +670,7 @@ png_decompress_chunk(png_structrp png_ptr,
|
|||||||
* success)
|
* success)
|
||||||
*/
|
*/
|
||||||
png_free(png_ptr, text);
|
png_free(png_ptr, text);
|
||||||
|
text = NULL;
|
||||||
|
|
||||||
/* This really is very benign, but it's still an error because
|
/* This really is very benign, but it's still an error because
|
||||||
* the extra space may otherwise be used as a Trojan Horse.
|
* the extra space may otherwise be used as a Trojan Horse.
|
||||||
|
@ -933,12 +933,18 @@ png_write_destroy(png_structrp png_ptr)
|
|||||||
/* Free our memory. png_free checks NULL for us. */
|
/* Free our memory. png_free checks NULL for us. */
|
||||||
png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
|
png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
|
||||||
png_free(png_ptr, png_ptr->row_buf);
|
png_free(png_ptr, png_ptr->row_buf);
|
||||||
|
png_ptr->row_buf = NULL;
|
||||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||||
png_free(png_ptr, png_ptr->prev_row);
|
png_free(png_ptr, png_ptr->prev_row);
|
||||||
png_free(png_ptr, png_ptr->sub_row);
|
png_free(png_ptr, png_ptr->sub_row);
|
||||||
png_free(png_ptr, png_ptr->up_row);
|
png_free(png_ptr, png_ptr->up_row);
|
||||||
png_free(png_ptr, png_ptr->avg_row);
|
png_free(png_ptr, png_ptr->avg_row);
|
||||||
png_free(png_ptr, png_ptr->paeth_row);
|
png_free(png_ptr, png_ptr->paeth_row);
|
||||||
|
png_ptr->prev_row = NULL;
|
||||||
|
png_ptr->sub_row = NULL;
|
||||||
|
png_ptr->up_row = NULL;
|
||||||
|
png_ptr->avg_row = NULL;
|
||||||
|
png_ptr->paeth_row = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||||
@ -946,10 +952,13 @@ png_write_destroy(png_structrp png_ptr)
|
|||||||
png_reset_filter_heuristics(png_ptr);
|
png_reset_filter_heuristics(png_ptr);
|
||||||
png_free(png_ptr, png_ptr->filter_costs);
|
png_free(png_ptr, png_ptr->filter_costs);
|
||||||
png_free(png_ptr, png_ptr->inv_filter_costs);
|
png_free(png_ptr, png_ptr->inv_filter_costs);
|
||||||
|
png_ptr->filter_costs = NULL;
|
||||||
|
png_ptr->inv_filter_costs = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
png_free(png_ptr, png_ptr->chunk_list);
|
png_free(png_ptr, png_ptr->chunk_list);
|
||||||
|
png_ptr->chunk_list = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The error handling and memory handling information is left intact at this
|
/* The error handling and memory handling information is left intact at this
|
||||||
|
Loading…
Reference in New Issue
Block a user