Fix a potential memory leak in crypto/provider_child.c

Fix issue #20063.
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20163)
This commit is contained in:
Ruili Fang 2023-01-28 23:48:24 -05:00 committed by Pauli
parent 0414899887
commit e788c772b1

View File

@ -135,8 +135,10 @@ static int provider_create_child_cb(const OSSL_CORE_HANDLE *prov, void *cbdata)
1)) == NULL)
goto err;
if (!ossl_provider_activate(cprov, 0, 0))
if (!ossl_provider_activate(cprov, 0, 0)) {
ossl_provider_free(cprov);
goto err;
}
if (!ossl_provider_set_child(cprov, prov)
|| !ossl_provider_add_to_store(cprov, NULL, 0)) {