From 7b398ad9244769974cc63d88c5e2dc5525fa02a2 Mon Sep 17 00:00:00 2001 From: Daan Date: Sat, 2 Mar 2024 15:51:51 -0800 Subject: [PATCH] delete pthread key at shutdown, PR #810 by @jkriegshauser --- src/prim/unix/prim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/prim/unix/prim.c b/src/prim/unix/prim.c index 94ae7946..4490c058 100644 --- a/src/prim/unix/prim.c +++ b/src/prim/unix/prim.c @@ -829,7 +829,9 @@ void _mi_prim_thread_init_auto_done(void) { } void _mi_prim_thread_done_auto_done(void) { - // nothing to do + if (_mi_heap_default_key != (pthread_key_t)(-1)) { // do not leak the key, see issue #809 + pthread_key_delete(_mi_heap_default_key); + } } void _mi_prim_thread_associate_default_heap(mi_heap_t* heap) {