From: Holger Dengler Date: Thu, 14 Nov 2024 08:55:50 +0000 (+0100) Subject: Fix memleak in dsa_gen() X-Git-Tag: openssl-3.3.3~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ade987cc7085a95e47a395096775e1e083c58a3;p=thirdparty%2Fopenssl.git Fix memleak in dsa_gen() Free the stack return value `dsa` on each early exit. Fixes #25905 Signed-off-by: Holger Dengler Reviewed-by: Kurt Roeckx Reviewed-by: Saša Nedvědický Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25948) (cherry picked from commit f4550fb5b518d2b910222bca2317d813cf092b53) --- diff --git a/providers/implementations/keymgmt/dsa_kmgmt.c b/providers/implementations/keymgmt/dsa_kmgmt.c index 3ad4e598c8f..f400c0c144c 100644 --- a/providers/implementations/keymgmt/dsa_kmgmt.c +++ b/providers/implementations/keymgmt/dsa_kmgmt.c @@ -587,7 +587,7 @@ static void *dsa_gen(void *genctx, OSSL_CALLBACK *osslcb, void *cbarg) && (gctx->gen_type <= DSA_PARAMGEN_TYPE_FIPS_DEFAULT))) { ERR_raise_data(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR, "gen_type set to unsupported value %d", gctx->gen_type); - return NULL; + goto end; } gctx->cb = osslcb;