summaryrefslogtreecommitdiff
path: root/weakmap.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-09-06 14:20:23 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-09-06 14:20:23 -0400
commit12102d101af258d7a3e9695b736a189cd3658df1 (patch)
tree3182fb5048cb979df6b0d84c41e2469fe9fb6a57 /weakmap.c
parent746eede412f083dc93923e39e3299c69fce46c15 (diff)
Fix crash in WeakMap during compaction
WeakMap can crash during compaction because the st_insert could allocate memory.
Diffstat (limited to 'weakmap.c')
-rw-r--r--weakmap.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/weakmap.c b/weakmap.c
index d79f5b3f94..3c7fd43f9b 100644
--- a/weakmap.c
+++ b/weakmap.c
@@ -122,7 +122,11 @@ wmap_compact_table_i(st_data_t key, st_data_t val, st_data_t data)
if (key_obj != new_key_obj) {
*(VALUE *)key = new_key_obj;
- st_insert(table, key, val);
+ DURING_GC_COULD_MALLOC_REGION_START();
+ {
+ st_insert(table, key, val);
+ }
+ DURING_GC_COULD_MALLOC_REGION_END();
return ST_DELETE;
}