summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 6665a72b8..70c43b6a1 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2934,6 +2934,8 @@ void pop_stack(struct script_state* st, int start, int end)
struct script_retinfo* ri = data->u.ri;
if( ri->var_function )
script_free_vars(ri->var_function);
+ if( data->ref )
+ aFree(data->ref);
aFree(ri);
}
data->type = C_NOP;
@@ -4467,8 +4469,10 @@ BUILDIN_FUNC(callfunc)
if( data_isreference(data) && !data->ref )
{
const char* name = reference_getname(data);
- if( name[0] == '.' && name[1] == '@' )
- data->ref = &st->stack->var_function;
+ if( name[0] == '.' && name[1] == '@' ) {
+ data->ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 1);
+ data->ref[0] = st->stack->var_function;
+ }
else if( name[0] == '.' )
data->ref = &st->script->script_vars;
}
@@ -4513,8 +4517,10 @@ BUILDIN_FUNC(callsub)
if( data_isreference(data) && !data->ref )
{
const char* name = reference_getname(data);
- if( name[0] == '.' && name[1] == '@' )
- data->ref = &st->stack->var_function;
+ if( name[0] == '.' && name[1] == '@' ) {
+ data->ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 1);
+ data->ref[0] = st->stack->var_function;
+ }
}
}