From d2fedd629da8c68078eaad31b6bdaab8e29bb6c9 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 9 May 2015 21:47:00 -0500 Subject: [PATCH] [libpng16] Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds. --- ANNOUNCE | 8 +++++--- CHANGES | 6 ++++-- pngtest.c | 12 ++++++------ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index f33c61c63..00976e77b 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.18beta04 - May 7, 2015 +Libpng 1.6.18beta04 - May 9, 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. @@ -46,9 +46,11 @@ Version 1.6.18beta03 [May 6, 2015] and an example PNG generation tool, contrib/examples/genpng.c (John Bowler). -Version 1.6.18beta04 [May 7, 2015] +Version 1.6.18beta04 [May 9, 2015] PNG_RELEASE_BUILD replaces tests where the code depended on the build base - type and can be defined on the command line, allowing testing in beta builds. + type and can be defined on the command line, allowing testing in beta + builds (John Bowler). + Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 6f022bf93..1784e61ae 100644 --- a/CHANGES +++ b/CHANGES @@ -5226,9 +5226,11 @@ Version 1.6.18beta03 [May 6, 2015] and an example PNG generation tool, contrib/examples/genpng.c (John Bowler). -Version 1.6.18beta04 [May 7, 2015] +Version 1.6.18beta04 [May 9, 2015] PNG_RELEASE_BUILD replaces tests where the code depended on the build base - type and can be defined on the command line, allowing testing in beta builds. + type and can be defined on the command line, allowing testing in beta + builds (John Bowler). + Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngtest.c b/pngtest.c index 554790a89..5a64a7d75 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1,7 +1,7 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.6.17 [March 26, 2015] + * Last changed in libpng 1.6.18 [(PENDING RELEASE)] * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -565,6 +565,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) } /* Unlink the element from the list. */ + if (pinformation != NULL) { memory_infop *ppinfo = &pinformation; @@ -581,8 +582,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; } @@ -1833,10 +1833,10 @@ main(int argc, char *argv[]) k, (unsigned long)filters_used[k]); #endif #ifdef PNG_TIME_RFC1123_SUPPORTED - if (tIME_chunk_present != 0) - fprintf(STDERR, " tIME = %s\n", tIME_string); + if (tIME_chunk_present != 0) + fprintf(STDERR, " tIME = %s\n", tIME_string); - tIME_chunk_present = 0; + tIME_chunk_present = 0; #endif /* TIME_RFC1123 */ }