mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-05 01:24:53 +01:00
Free PNG structs after writing
This commit is contained in:
parent
43a9df351a
commit
b46c5de3ac
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue