From: Martin Kroeker Date: Sat, 29 Dec 2018 20:59:31 +0000 (+0100) Subject: Delete the pthread key on cleanup in TLS mode X-Git-Tag: v0.3.5~2^2~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bba1e672691cd62a2a0607865a2514334f8700e4;p=platform%2Fupstream%2Fopenblas.git 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 --- 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(){