diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-09-06 14:20:23 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-09-06 14:20:23 -0400 |
commit | 12102d101af258d7a3e9695b736a189cd3658df1 (patch) | |
tree | 3182fb5048cb979df6b0d84c41e2469fe9fb6a57 /weakmap.c | |
parent | 746eede412f083dc93923e39e3299c69fce46c15 (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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; } |