From fbadf1351940a8e6a184a736b1e2e81a575a0a80 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sun, 16 Mar 2014 17:01:12 -0300 Subject: Fixed Bug 8093 Special Thanks to Haruna for pinpointing the cause, developing test cases and contributing to the final solution :3 http://hercules.ws/board/tracker/issue-8093-memory-leak-after-stop-server-cant-fix/ Signed-off-by: shennetsind --- src/map/script.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/map/script.c b/src/map/script.c index 5a33a39ed..6bd215752 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8285,6 +8285,18 @@ BUILDIN(getgroupid) /// end BUILDIN(end) { st->state = END; + + /* are we stopping inside a function? */ + if( st->stack->defsp >= 1 && st->stack->stack_data[st->stack->defsp-1].type == C_RETINFO ) { + int i; + for(i = 0; i < st->stack->sp; i++) { + if( st->stack->stack_data[i].type == C_RETINFO ) {/* grab the first, aka the original */ + struct script_retinfo *ri = st->stack->stack_data[i].u.ri; + st->script = ri->script; + break; + } + } + } return true; } -- cgit v1.2.3-60-g2f50