From bba1e672691cd62a2a0607865a2514334f8700e4 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sat, 29 Dec 2018 21:59:31 +0100 Subject: [PATCH] Delete the pthread key on cleanup in TLS mode to avoid a crash when OpenBLAS was loaded via dlopen and libc tries to clean up the leaked TLS after dlclose Fixes #1720 --- driver/others/memory.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/driver/others/memory.c b/driver/others/memory.c index 36815a3..6f7a7db 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -1073,6 +1073,11 @@ static volatile int memory_initialized = 0; } free(table); } +#if defined(OS_WINDOWS) + TlsFree(local_storage_key); +#else + pthread_key_delete(local_storage_key); +#endif } static void blas_memory_init(){ -- 2.7.4