From a268f0dce511b6549cb2686d4bde2aaa6641ae33 Mon Sep 17 00:00:00 2001 From: ultramage Date: Sat, 13 Oct 2007 03:00:51 +0000 Subject: Fixed memleak hell during mapserver shutdown (if grf reading is used and the deallocation routine is actually called). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11439 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/grfio.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/common') diff --git a/src/common/grfio.c b/src/common/grfio.c index 4b68ea9fc..4e5da0a6a 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -777,20 +777,26 @@ static int grfio_add(char* fname) // removes all entries void grfio_final(void) { - if (filelist != NULL) - aFree(filelist); + if (filelist != NULL) { + int i; + for (i = 0; i < filelist_entrys; i++) + if (filelist[i].fnd != NULL) + aFree(filelist[i].fnd); + aFree(filelist); + filelist = NULL; + } filelist_entrys = filelist_maxentry = 0; if (gentry_table != NULL) { int i; - for (i = 0; i < gentry_entrys; i++) { + for (i = 0; i < gentry_entrys; i++) if (gentry_table[i] != NULL) aFree(gentry_table[i]); - } + aFree(gentry_table); + gentry_table = NULL; } - gentry_table = NULL; gentry_entrys = gentry_maxentry = 0; } -- cgit v1.2.3-70-g09d2