From: Tomas Mraz Date: Thu, 11 Apr 2024 07:27:47 +0000 (+0200) Subject: ossl_provider_new(): Fix memory leak on error X-Git-Tag: openssl-3.3.1~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6a784afa28526a84a2cc20b18a20f26ea480f0f;p=thirdparty%2Fopenssl.git ossl_provider_new(): Fix memory leak on error Fixes #24095 Reviewed-by: Tom Cosgrove Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/24100) (cherry picked from commit 875db35ac63beb0e5a3d520743fa55ad2e5ccd1d) --- diff --git a/crypto/provider_core.c b/crypto/provider_core.c index 8046b0b48c5..b0cb039705c 100644 --- a/crypto/provider_core.c +++ b/crypto/provider_core.c @@ -564,8 +564,10 @@ OSSL_PROVIDER *ossl_provider_new(OSSL_LIB_CTX *libctx, const char *name, if (params[i].data_type != OSSL_PARAM_UTF8_STRING) continue; if (ossl_provider_info_add_parameter(&template, params[i].key, - (char *)params[i].data) <= 0) + (char *)params[i].data) <= 0) { + sk_INFOPAIR_pop_free(template.parameters, infopair_free); return NULL; + } } }