summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-03-25 17:57:42 +0100
committerJo-Philipp Wich <jo@mein.io>2021-03-25 19:07:56 +0100
commit20a3763d0a9a5efe6478595fe5590d47bffa90fe (patch)
tree4c10486ce56eab49c032771dfac778acbc7a6c1b
parent9a6ef2bf3f9d0cabe39a05c72f70fc1799258c0f (diff)
vm: fix loop variable memory leak in NEXTK/NEXTKV instruction
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--vm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 929859d..4fd376e 100644
--- a/vm.c
+++ b/vm.c
@@ -1749,6 +1749,7 @@ uc_vm_insn_next(uc_vm *vm, enum insn_type insn)
uc_vm_stack_push(vm, uc_value_get((json_object *)curr->v));
uc_vm_stack_push(vm, k);
+ uc_value_put(v);
return;
}
@@ -1770,10 +1771,13 @@ uc_vm_insn_next(uc_vm *vm, enum insn_type insn)
uc_vm_stack_push(vm, uc_value_get(json_object_array_get_idx(v, n)));
uc_vm_stack_push(vm, k);
+ uc_value_put(v);
return;
}
+ uc_value_put(k);
+
break;
default:
@@ -1785,6 +1789,8 @@ uc_vm_insn_next(uc_vm *vm, enum insn_type insn)
if (insn == I_NEXTKV)
uc_vm_stack_push(vm, NULL);
+
+ uc_value_put(v);
}
static void