Fix lock leak in evp_keymgmt_util_export_to_provider()

Fixes #16847

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16849)
This commit is contained in:
Richard Levitte 2021-10-16 10:22:42 +02:00
parent d5d95daba5
commit fb0f65fff8

View File

@ -197,6 +197,7 @@ void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt)
/* Add the new export to the operation cache */
if (!evp_keymgmt_util_cache_keydata(pk, keymgmt, import_data.keydata)) {
CRYPTO_THREAD_unlock(pk->lock);
evp_keymgmt_freedata(keymgmt, import_data.keydata);
return NULL;
}