From 8583cc23e418fcc8a20b453f48b72075e64667f4 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 9 May 2015 21:44:18 -0500 Subject: [PATCH] [libpng15] Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds. --- ANNOUNCE | 7 +++++-- CHANGES | 5 ++++- pngtest.c | 9 +++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 423560a88..2dfb5e3bf 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.5.23beta01 - April 29, 2015 +Libpng 1.5.23beta01 - May 10, 2015 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. @@ -27,11 +27,14 @@ Other information: Changes since the last public release (1.5.22): -Version 1.5.23beta01 [April 29, 2015] +Version 1.5.23beta01 [May 10, 2015] Removed unused PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED definitions from pnglibconf.h.prebuilt (Andrew Church). Replaced "unexpected" with an integer in pngset.c where a long was expected, to avoid a compiler warning when PNG_DEBUG > 1. + Fix typecast in a png_debug2() statement in png_set_text_2() to + avoid a compiler warning in PNG_DEBUG builds. + Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 7af077870..2752af3bd 100644 --- a/CHANGES +++ b/CHANGES @@ -4334,11 +4334,14 @@ Version 1.5.22rc04 [March 16, 2015] Version 1.5.22 [March 26, 2015] No changes. -Version 1.5.23beta01 [April 29, 2015] +Version 1.5.23beta01 [May 10, 2015] Removed unused PNG_SET_CHUNK_[CACHE|MALLOC]_LIMIT_SUPPORTED definitions from pnglibconf.h.prebuilt (Andrew Church). Replaced "unexpected" with an integer in pngset.c where a long was expected, to avoid a compiler warning when PNG_DEBUG > 1. + Fix typecast in a png_debug2() statement in png_set_text_2() to + avoid a compiler warning in PNG_DEBUG builds. + Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngtest.c b/pngtest.c index 3c0180403..d6b5a3f10 100644 --- a/pngtest.c +++ b/pngtest.c @@ -564,6 +564,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) } /* Unlink the element from the list. */ + if (pinformation != NULL) { memory_infop *ppinfo = &pinformation; @@ -580,8 +581,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) /* We must free the list element too, but first kill the memory that is to be freed. */ memset(ptr, 0x55, pinfo->size); - if (pinfo != NULL) - free(pinfo); + free(pinfo); pinfo = NULL; break; } @@ -1463,8 +1463,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) png_set_tIME(write_ptr, write_end_info_ptr, mod_time); #ifdef PNG_TIME_RFC1123_SUPPORTED /* We have to use memcpy instead of "=" because the string - pointed to by png_convert_to_rfc1123() gets free'ed before - we use it */ + * pointed to by png_convert_to_rfc1123() gets free'ed before + * we use it. + */ memcpy(tIME_string, png_convert_to_rfc1123(read_ptr, mod_time), png_sizeof(tIME_string));