We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ba36e2 commit 19160f0Copy full SHA for 19160f0
core/iwasm/common/wasm_memory.c
@@ -534,10 +534,15 @@ wasm_runtime_memory_init(mem_alloc_type_t mem_alloc_type,
534
static void
535
destroy_shared_heaps()
536
{
537
- WASMSharedHeap *heap = shared_heap_list;
+ WASMSharedHeap *heap;
538
WASMSharedHeap *cur;
539
uint64 map_size;
540
541
+ os_mutex_lock(&shared_heap_list_lock);
542
+ heap = shared_heap_list;
543
+ shared_heap_list = NULL;
544
+ os_mutex_unlock(&shared_heap_list_lock);
545
+
546
while (heap) {
547
cur = heap;
548
heap = heap->next;
@@ -551,6 +556,7 @@ destroy_shared_heaps()
551
556
wasm_munmap_linear_memory(cur->base_addr, cur->size, map_size);
552
557
wasm_runtime_free(cur);
553
558
}
559
+ os_mutex_destroy(&shared_heap_list_lock);
554
560
555
561
#endif
562
0 commit comments