Fix windows thread stop code
authorMatt Caswell <matt@openssl.org>
Thu, 18 Feb 2016 12:24:09 +0000 (12:24 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 18 Feb 2016 15:27:16 +0000 (15:27 +0000)
The windows thread stop code was erroneously not just deleting the thread
local variable on thread stop, but also deleting the thread local *key*
(thus removing thread local data for *all* threads in one go!).

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/init.c

index 8775b82a228315640e536f0b03904fb0db9c2273..cbe07df2a29e1eca3c2ef7319c0d2375fd7564f8 100644 (file)
@@ -506,7 +506,6 @@ static void ossl_init_thread_stop(struct thread_local_inits_st *locals)
     }
 
     OPENSSL_free(locals);
-    ossl_init_thread_stop_cleanup();
 }
 
 void OPENSSL_thread_stop(void)
@@ -599,6 +598,8 @@ void OPENSSL_cleanup(void)
         ERR_free_strings();
     }
 
+    ossl_init_thread_stop_cleanup();
+
 #ifdef OPENSSL_INIT_DEBUG
     fprintf(stderr, "OPENSSL_INIT: OPENSSL_INIT_library_stop: "
                     "CRYPTO_cleanup_all_ex_data()\n");