提交 adeb4bc7 编写于 作者: B Benjamin Kaduk 提交者: Ben Kaduk

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: NKurt Roeckx <kurt@roeckx.be>
Reviewed-by: NMatthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5089)
上级 63ab5ea1
...@@ -421,6 +421,7 @@ void OPENSSL_cleanup(void) ...@@ -421,6 +421,7 @@ void OPENSSL_cleanup(void)
stop_handlers = NULL; stop_handlers = NULL;
CRYPTO_THREAD_lock_free(init_lock); CRYPTO_THREAD_lock_free(init_lock);
init_lock = NULL;
/* /*
* We assume we are single-threaded for this function, i.e. no race * We assume we are single-threaded for this function, i.e. no race
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册