From 1e8223a21236bce8f13074d943f8c2055eaaa726 Mon Sep 17 00:00:00 2001 From: Haru Date: Sat, 14 Mar 2015 04:02:57 +0100 Subject: Fixed a script function related memory leak on mapserver shutdown - If a script function was running when the server is shut down, the memory allocated by its local variables would not get freed. - Special thanks to Ind. Signed-off-by: Haru --- src/map/script.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 235b7b8d5..39f8a7b63 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -3387,15 +3387,13 @@ void script_free_code(struct script_code* code) { nullpo_retv(code); - if( code->instances ) + if (code->instances) script->stop_instances(code); - else { - script->free_vars(code->local.vars); - if( code->local.arrays ) - code->local.arrays->destroy(code->local.arrays,script->array_free_db); - } - aFree( code->script_buf ); - aFree( code ); + script->free_vars(code->local.vars); + if (code->local.arrays) + code->local.arrays->destroy(code->local.arrays,script->array_free_db); + aFree(code->script_buf); + aFree(code); } /// Creates a new script state. -- cgit v1.2.3-70-g09d2