summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/script.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 63b76e35b..5a33a39ed 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3210,6 +3210,11 @@ void script_free_code(struct script_code* code)
{
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 );
}