diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-10-23 10:29:55 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-10-23 10:32:56 +0200 |
commit | 0f022aae0c6008fe6f2219871d32dca8b9105066 (patch) | |
tree | e1ccc24b8b4d61d896db57bfa447202de264f12b /lib/math.c | |
parent | 9041e2403d98fdb54206c23bd684a7da6fb63026 (diff) |
lib: increase refcount when returning cached module instance
Subsequent requires of the same module returned the cached module instance
without increasing the refcount, leading to use-after-free on VM tear down
or garbage collection cycles.
Solve this issue by properly incrementing the refcount before returning
the cached module instance.
Fixes: #25
Fixes: 96f140b ("lib, vm: ensure that require() compiles modules only once")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib/math.c')
0 files changed, 0 insertions, 0 deletions