From 89c6a70620436a877ae910374abd88d052448437 Mon Sep 17 00:00:00 2001 From: Andrea Date: Mon, 28 Jun 2021 14:24:03 +0100 Subject: [PATCH] Only reset pointer if it is freed (#16) The indentation shows these statements were supposed to be bracketed. --- libpng/pngwutil.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libpng/pngwutil.c b/libpng/pngwutil.c index 05468c4..a14c3bf 100644 --- a/libpng/pngwutil.c +++ b/libpng/pngwutil.c @@ -350,8 +350,10 @@ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp) comp->output_ptr[i]=NULL; } if (comp->max_output_ptr != 0) + { png_free(png_ptr, comp->output_ptr); comp->output_ptr=NULL; + } /* write anything left in zbuf */ if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size) png_write_chunk_data(png_ptr, png_ptr->zbuf,