Fix small memory leak
This commit is contained in:
@@ -32,6 +32,6 @@ set(
|
|||||||
CACHE INTERNAL "tarball basename"
|
CACHE INTERNAL "tarball basename"
|
||||||
)
|
)
|
||||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||||
set(CPACK_SOURCE_IGNORE_FILES "/.git/;.gitignore;.tar.gz$;/Makefile;/CMakeCache.txt;/CMakeFiles/;cmake_install.cmake;install_manifest.txt;/_CPack;/mazemaker$;/config.h$;.cmake$;${CPACK_SOURCE_IGNORE_FILES}")
|
set(CPACK_SOURCE_IGNORE_FILES "*.png;/logs/;/.git/;.gitignore;.tar.gz$;/Makefile;/CMakeCache.txt;/CMakeFiles/;cmake_install.cmake;install_manifest.txt;/_CPack;/mazemaker$;/config.h$;.cmake$;${CPACK_SOURCE_IGNORE_FILES}")
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define _GRID_H 1
|
#define _GRID_H 1
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef uint8_t edgeweight_t;
|
typedef uint8_t edgeweight_t;
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,10 @@ int writePNG(mazegrid_t const* g, char const* filename) {
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (f != NULL) fclose(f);
|
if (f != NULL) fclose(f);
|
||||||
if (info_ptr != NULL) png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
if (info_ptr != NULL) {
|
||||||
|
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
|
||||||
|
png_destroy_info_struct(png_ptr, &info_ptr);
|
||||||
|
}
|
||||||
if (png_ptr != NULL) png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
if (png_ptr != NULL) png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
||||||
if (img != NULL) freeImageData(img);
|
if (img != NULL) freeImageData(img);
|
||||||
return code;
|
return code;
|
||||||
|
|||||||
Reference in New Issue
Block a user