summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-02-02 18:52:33 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-02-02 18:52:33 +0100
commitb46c5de3ace2fdfbcb8fb8c0dd318a389cceb55a (patch)
tree94084bfed19bd6e83c7ac6ca4c911d07303947af /src
parent43a9df351ac3c69bcd19e8dbb84583181f59ee22 (diff)
downloadMinedMap-b46c5de3ace2fdfbcb8fb8c0dd318a389cceb55a.tar
MinedMap-b46c5de3ace2fdfbcb8fb8c0dd318a389cceb55a.zip
Free PNG structs after writing
Diffstat (limited to 'src')
-rw-r--r--src/MinedMap.cpp3
1 files changed, 2 insertions, 1 deletions
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);
}