]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Don't cleanup uninitialized thread local slots
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sat, 28 Apr 2018 17:09:55 +0000 (19:09 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Sat, 28 Apr 2018 17:09:55 +0000 (19:09 +0200)
Fixes: #6120
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/6123)

crypto/rand/drbg_lib.c

index c6397b22c6d4e94bcbd88556699326168ab23776..60ddd2fe204b409a940663be9ca746fd9df8c9c7 100644 (file)
@@ -912,11 +912,13 @@ err1:
 /* Clean up the global DRBGs before exit */
 void rand_drbg_cleanup_int(void)
 {
-    RAND_DRBG_free(master_drbg);
-    master_drbg = NULL;
+    if (master_drbg != NULL) {
+        RAND_DRBG_free(master_drbg);
+        master_drbg = NULL;
 
-    CRYPTO_THREAD_cleanup_local(&private_drbg);
-    CRYPTO_THREAD_cleanup_local(&public_drbg);
+        CRYPTO_THREAD_cleanup_local(&private_drbg);
+        CRYPTO_THREAD_cleanup_local(&public_drbg);
+    }
 }
 
 void drbg_delete_thread_state()