From: Benjamin Kaduk Date: Fri, 26 Jan 2018 15:32:40 +0000 (-0600) Subject: Restore clearing of init_lock after free X-Git-Tag: OpenSSL_1_1_1-pre1~84 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=adeb4bc7a03aa61b6b26c3857dd91b05164daa60;p=oweals%2Fopenssl.git Restore clearing of init_lock after free The behavior of resetting the init_lock value to NULL after freeing it during OPENSSL_cleanup() was added as part of the global lock commits that were just reverted, but there is desire to retain this behavior for clarity. It is unclear that the library would actually remain usable in any form after OPENSSL_cleanup(), since the required re-initialization occurs under a CRYPTO_ONCE check that cannot be reset at cleanup time. That said, a NULL dereference is probably more friendly behavior in these treacherous waters than using freed memory would be. Reviewed-by: Kurt Roeckx Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/5089) --- diff --git a/crypto/init.c b/crypto/init.c index 71accaa2ca..1b94d07e04 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -421,6 +421,7 @@ void OPENSSL_cleanup(void) stop_handlers = NULL; CRYPTO_THREAD_lock_free(init_lock); + init_lock = NULL; /* * We assume we are single-threaded for this function, i.e. no race