mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
Recycle the TLS key that holds thread_event_handler
Fixes #25278 Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/25300)
This commit is contained in:
parent
09ae1c9f5a
commit
36840ab577
@ -266,9 +266,8 @@ void *ossl_thread_event_ctx_new(OSSL_LIB_CTX *libctx)
|
|||||||
if (tlocal == NULL)
|
if (tlocal == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!CRYPTO_THREAD_init_local(tlocal, NULL)) {
|
if (!CRYPTO_THREAD_init_local(tlocal, NULL))
|
||||||
goto err;
|
goto deinit;
|
||||||
}
|
|
||||||
|
|
||||||
hands = OPENSSL_zalloc(sizeof(*hands));
|
hands = OPENSSL_zalloc(sizeof(*hands));
|
||||||
if (hands == NULL)
|
if (hands == NULL)
|
||||||
@ -290,12 +289,15 @@ void *ossl_thread_event_ctx_new(OSSL_LIB_CTX *libctx)
|
|||||||
return tlocal;
|
return tlocal;
|
||||||
err:
|
err:
|
||||||
OPENSSL_free(hands);
|
OPENSSL_free(hands);
|
||||||
|
CRYPTO_THREAD_cleanup_local(tlocal);
|
||||||
|
deinit:
|
||||||
OPENSSL_free(tlocal);
|
OPENSSL_free(tlocal);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ossl_thread_event_ctx_free(void *tlocal)
|
void ossl_thread_event_ctx_free(void *tlocal)
|
||||||
{
|
{
|
||||||
|
CRYPTO_THREAD_cleanup_local(tlocal);
|
||||||
OPENSSL_free(tlocal);
|
OPENSSL_free(tlocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user