diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-07-07 21:11:17 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-07-07 21:11:17 +0200 |
commit | 6f05cddf4676225cb76f160ae44857373869acb0 (patch) | |
tree | 57fc09c8895a792429aa2d8bf379a1daa9d19f81 /lib.c | |
parent | 96f140bd8c39ccb44efa630b0ff6096d53b94456 (diff) |
lib: fix refcount imbalance in uc_require_path()
Ensure to increase the refcount of the module scope value when caching it
in the global module registry to avoid a double free on VM teardown.
Fixes: 96f140b ("lib, vm: ensure that require() compiles modules only once")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1626,7 +1626,7 @@ uc_require_path(uc_vm *vm, const char *path_template, const char *name, uc_value rv = uc_require_ucode(vm, buf->buf, NULL, res); if (rv) - ucv_object_add(modtable, name, *res); + ucv_object_add(modtable, name, ucv_get(*res)); out: printbuf_free(buf); |