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)
(cherry picked from commit
36840ab577d547a35cbc7c72396dc7931712eb6e)
if (tlocal == NULL)
return NULL;
- if (!CRYPTO_THREAD_init_local(tlocal, NULL)) {
- goto err;
- }
+ if (!CRYPTO_THREAD_init_local(tlocal, NULL))
+ goto deinit;
hands = OPENSSL_zalloc(sizeof(*hands));
if (hands == NULL)
return tlocal;
err:
OPENSSL_free(hands);
+ CRYPTO_THREAD_cleanup_local(tlocal);
+ deinit:
OPENSSL_free(tlocal);
return NULL;
}
void ossl_thread_event_ctx_free(void *tlocal)
{
+ CRYPTO_THREAD_cleanup_local(tlocal);
OPENSSL_free(tlocal);
}