From: Holger Dengler Date: Thu, 14 Nov 2024 08:55:50 +0000 (+0100) Subject: Fix memleak in dsa_gen() X-Git-Tag: openssl-3.4.1~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7a93ee7e0d4ce479346ac4de0d34d02f332f142;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 83ff02e4ca7..c51ef9d11db 100644 --- a/providers/implementations/keymgmt/dsa_kmgmt.c +++ b/providers/implementations/keymgmt/dsa_kmgmt.c @@ -631,7 +631,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;