summaryrefslogtreecommitdiffhomepage
path: root/vm.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-05-26 13:28:07 +0200
committerJo-Philipp Wich <jo@mein.io>2021-07-11 15:49:14 +0200
commitbf8522625f55fa2657dee3b9356b20fa0dba725f (patch)
tree82dea1608c84f4b6314f2500271258e4455ecf9d /vm.c
parente2b3d2ef25c5e55122c1e41ab56af1075209b47d (diff)
treewide: move ressource type registry into vm instance
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 083c418..abea567 100644
--- a/vm.c
+++ b/vm.c
@@ -126,6 +126,7 @@ void uc_vm_init(uc_vm *vm, uc_parse_config *config)
void uc_vm_free(uc_vm *vm)
{
uc_upvalref_t *ref;
+ size_t i;
ucv_put(vm->exception.stacktrace);
free(vm->exception.message);
@@ -136,6 +137,9 @@ void uc_vm_free(uc_vm *vm)
vm->open_upvals = ref;
}
+ for (i = 0; i < vm->restypes.count; i++)
+ ucv_put(vm->restypes.entries[i]->proto);
+
uc_vm_reset_callframes(vm);
uc_vm_reset_stack(vm);
uc_vector_clear(&vm->stack);
@@ -144,6 +148,11 @@ void uc_vm_free(uc_vm *vm)
printbuf_free(vm->strbuf);
ucv_gc(vm, true);
+
+ for (i = 0; i < vm->restypes.count; i++)
+ free(vm->restypes.entries[i]);
+
+ uc_vector_clear(&vm->restypes);
}
static uc_chunk *