summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-03-24 23:23:00 +0100
committerJo-Philipp Wich <jo@mein.io>2021-03-24 23:23:00 +0100
commit86e3970643e03a5e02f3eac2a52794bd6c040f30 (patch)
tree3553de9b4f6a3827691c1d9c1761b28362d8864d
parentfe464eaa5ed78d0f1f0710b8523d7608a90ca3e1 (diff)
lib: fix value refcount of uc_unshift() return value
The ref count of the unshifted value returned by uc_unshift() must be increased in order to prevent a subsequent double free within the VM when the value eventually goes out of scope. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 1c4908f..2d96aa3 100644
--- a/lib.c
+++ b/lib.c
@@ -502,7 +502,7 @@ uc_unshift(uc_vm *vm, size_t nargs)
json_object_array_put_idx(arr, arridx, uc_value_get(item));
}
- return item;
+ return uc_value_get(item);
}
static json_object *