Skip to content

Commit ba446ee

Browse files
committed
add extra tld==NULL check for free's after a thread has terminated (pr #1289)
1 parent 5580555 commit ba446ee

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/free.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static mi_decl_noinline bool mi_abandoned_page_try_reclaim(mi_page_t* page, long
322322

323323
// get our theap
324324
mi_theap_t* const theap = _mi_page_associated_theap_peek(page);
325-
if (theap==NULL || !theap->allow_page_reclaim) return false;
325+
if (theap==NULL || theap->tld==NULL || !theap->allow_page_reclaim) return false; // see issue #1289
326326

327327
// todo: cache `is_in_threadpool` and `exclusive_arena` directly in the theap for performance?
328328
// set max_reclaim limit

src/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ mi_subproc_t* _mi_subproc(void) {
426426
// on such systems we can check for this with the _mi_prim_get_default_theap as those are protected (by being
427427
// stored in a TLS slot for example)
428428
mi_theap_t* theap = _mi_theap_default();
429-
if (theap == NULL || theap->tld == NULL) {
429+
if (theap == NULL || theap->tld == NULL) { // see issue #1289
430430
return _mi_subproc_main();
431431
}
432432
else {

0 commit comments

Comments
 (0)