Util: Fix memory leak in Configuration
Jeffrey Pfau jeffrey@endrift.com
Wed, 05 Nov 2014 02:45:00 -0800
1 files changed,
6 insertions(+),
1 deletions(-)
jump to
M
src/util/configuration.c
→
src/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); }