Fix memleak in dsa_gen()

Free the stack return value `dsa` on each early exit.

Fixes #25905

Signed-off-by: Holger Dengler <dengler@linux.ibm.com>

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25948)
This commit is contained in:
Holger Dengler 2024-11-14 09:55:50 +01:00 committed by Tomas Mraz
parent 79c98fc6cc
commit f4550fb5b5

View File

@ -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;