Skip to content

Commit 7b398ad

Browse files
committed
delete pthread key at shutdown, PR #810 by @jkriegshauser
1 parent 944ec1a commit 7b398ad

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/prim/unix/prim.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,9 @@ void _mi_prim_thread_init_auto_done(void) {
829829
}
830830

831831
void _mi_prim_thread_done_auto_done(void) {
832-
// nothing to do
832+
if (_mi_heap_default_key != (pthread_key_t)(-1)) { // do not leak the key, see issue #809
833+
pthread_key_delete(_mi_heap_default_key);
834+
}
833835
}
834836

835837
void _mi_prim_thread_associate_default_heap(mi_heap_t* heap) {

0 commit comments

Comments
 (0)