summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2018-04-28 19:09:55 +0200
committerBernd Edlinger <bernd.edlinger@hotmail.de>2018-04-28 19:09:55 +0200
commitbf7ae7500073f85fed8a82c4f8ec981d44a8c3d6 (patch)
treec1e4e0e608b4264fa68e20036c7f5feee6d520ee
parent272c0df8e1aa549da9060bf70b34c9aabb3bcb0d (diff)
Don't cleanup uninitialized thread local slots
Fixes: #6120 Reviewed-by: Kurt Roeckx <kurt@roeckx.be> (Merged from https://github.com/openssl/openssl/pull/6123)
-rw-r--r--crypto/rand/drbg_lib.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/rand/drbg_lib.c b/crypto/rand/drbg_lib.c
index c6397b22c6..60ddd2fe20 100644
--- a/crypto/rand/drbg_lib.c
+++ b/crypto/rand/drbg_lib.c
@@ -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()