avoid accessing heap->tld after running thread_done (pr #974)

This commit is contained in:
Daan Leijen 2024-12-30 11:34:02 -08:00
parent e183384ad0
commit 9f70ce5fcd
3 changed files with 13 additions and 7 deletions

View file

@ -393,9 +393,10 @@ void mi_heap_destroy(mi_heap_t* heap) {
}
// forcefully destroy all heaps in the current thread
void _mi_heap_unsafe_destroy_all(void) {
mi_heap_t* bheap = mi_heap_get_backing();
mi_heap_t* curr = bheap->tld->heaps;
void _mi_heap_unsafe_destroy_all(mi_heap_t* heap) {
mi_assert_internal(heap != NULL);
if (heap == NULL) return;
mi_heap_t* curr = heap->tld->heaps;
while (curr != NULL) {
mi_heap_t* next = curr->next;
if (curr->no_reclaim) {