all repos — mgba @ f4d6ef74b426385ea655d26fd29224219fa2374c

mGBA Game Boy Advance Emulator

Util: Fix memory leak in Configuration
Jeffrey Pfau jeffrey@endrift.com
Wed, 05 Nov 2014 02:45:00 -0800
commit

f4d6ef74b426385ea655d26fd29224219fa2374c

parent

0fd9e9ad0fd16777e2aff75b027be010cafcc865

1 files changed, 6 insertions(+), 1 deletions(-)

jump to
M src/util/configuration.csrc/util/configuration.c

@@ -6,6 +6,11 @@ #include "third-party/inih/ini.h"

#include <float.h> +static void _tableDeinit(void* table) { + TableDeinit(table); + free(table); +} + static void _sectionDeinit(void* string) { free(string); }

@@ -29,7 +34,7 @@ dprintf((int) user, "\n");

} void ConfigurationInit(struct Configuration* configuration) { - HashTableInit(&configuration->sections, 0, (void (*)(void *)) TableDeinit); + HashTableInit(&configuration->sections, 0, _tableDeinit); HashTableInit(&configuration->root, 0, _sectionDeinit); }