summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-03-16 17:01:12 -0300
committershennetsind <ind@henn.et>2014-03-16 17:01:12 -0300
commitfbadf1351940a8e6a184a736b1e2e81a575a0a80 (patch)
tree17664f621ebbde5069578a3f6272f6eb1c179c35
parent502f2510a29d3b32cd601c775817bd9e98c7fc0d (diff)
downloadhercules-fbadf1351940a8e6a184a736b1e2e81a575a0a80.tar.gz
hercules-fbadf1351940a8e6a184a736b1e2e81a575a0a80.tar.bz2
hercules-fbadf1351940a8e6a184a736b1e2e81a575a0a80.tar.xz
hercules-fbadf1351940a8e6a184a736b1e2e81a575a0a80.zip
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 <ind@henn.et>
-rw-r--r--src/map/script.c12
1 files changed, 12 insertions, 0 deletions
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;
}