From b46c5de3ace2fdfbcb8fb8c0dd318a389cceb55a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 2 Feb 2015 18:52:33 +0100 Subject: Free PNG structs after writing --- src/MinedMap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MinedMap.cpp b/src/MinedMap.cpp index 3374637..004d39e 100644 --- a/src/MinedMap.cpp +++ b/src/MinedMap.cpp @@ -80,7 +80,7 @@ static void writePNG(const char *filename, const uint32_t data[DIM][DIM]) { if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, &info_ptr); - fclose(f); + std::fclose(f); throw std::runtime_error("unable to write PNG file"); } @@ -96,6 +96,7 @@ static void writePNG(const char *filename, const uint32_t data[DIM][DIM]) { png_set_rows(png_ptr, info_ptr, row_pointers); png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); + png_destroy_write_struct(&png_ptr, &info_ptr); std::fclose(f); } -- cgit v1.2.3