summaryrefslogtreecommitdiffhomepage
path: root/vm.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-05-26 23:21:53 +0200
committerJo-Philipp Wich <jo@mein.io>2023-05-28 20:49:03 +0200
commit66520ebe27ae7e8d880549a65f18abb326ff9873 (patch)
treeb0f3d794bff08bbf3c471e207976308ac9f596e3 /vm.c
parentb213bd120d5532cd3e4e40160b18c18e2aca37c7 (diff)
vm: immediately release arguments on calls with invalid spreads
Ensure to release the `this` context and the temporary argument stash when we raise a non iterable type exception due to non-iterable values while precessing spread operations in function call arguments. Those values would've been garbage collected eventually but explicitly releasing them here will allow the vm to free them immediately. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 8512f8c..16bf6c5 100644
--- a/vm.c
+++ b/vm.c
@@ -528,7 +528,9 @@ uc_vm_call_function(uc_vm_t *vm, uc_value_t *ctx, uc_value_t *fno, bool mcall, s
s = ucv_to_string(vm, arg);
uc_vm_raise_exception(vm, EXCEPTION_TYPE, "(%s) is not iterable", s);
free(s);
+ ucv_put(ctx);
ucv_put(fno);
+ ucv_put(ellip);
return false;
}