diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-03-04 15:48:36 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-03-08 17:11:49 +0100 |
commit | e88ed690d38beaf2b9919e2fc03223d33f24459a (patch) | |
tree | 8aa51fa0437d4a57199075ed39aff8825056394b | |
parent | c433a31360612dfd5b263cea5afa8e2c8fbcca5b (diff) |
vm: fix global scope refcount imbalance
The uc_vm_execute() API function decreases the refcount of the globals
object when finishing but does not increase it initially which leads to
a double free at main.c:155
Fix the issue by both increasing and decreasing the refcount.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | vm.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -2182,6 +2182,7 @@ uc_vm_execute(uc_vm *vm, uc_function *fn, uc_prototype *globals, json_object *mo uc_vm_status_t rv; vm->globals = globals; + uc_value_get(globals ? globals->header.jso : NULL); uc_vector_grow(&vm->callframes); |