aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Lockwood2021-06-28 22:07:19 -0400
committerAlexis Lockwood2021-06-28 22:07:19 -0400
commitd9402a8edfe8be1901920f334105d0455812a576 (patch)
treea0665d04a209de8856aab5ff189755a5221e0745
parentb937c97fc11c0b065493ff6775c76990e131059e (diff)
Reuse ls_free_val in RETURN
-rw-r--r--src/ls_kw_impl_GOSUB_RETURN.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/ls_kw_impl_GOSUB_RETURN.c b/src/ls_kw_impl_GOSUB_RETURN.c
index 13dfecf..8e8d850 100644
--- a/src/ls_kw_impl_GOSUB_RETURN.c
+++ b/src/ls_kw_impl_GOSUB_RETURN.c
@@ -112,16 +112,9 @@ void ls_kw_fun_RETURN(ls_t * self)
ls_eval_expr(self, &val, &tok);
// Free the scope
- ls_value_t * next;
- for (ls_value_t * i = self->_callstack->next; i; i = next)
- {
- next = i->next;
- ls_free(self, i);
- }
-
ls_value_t * frame = self->_callstack->prev;
ls_addr_t pc = self->_callstack->body.sctx_call.pc;
- ls_free(self, self->_callstack);
+ ls_free_val(self, self->_callstack);
self->_callstack = frame;
self->_pc = pc;