]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix memleak in dsa_gen()
authorHolger Dengler <dengler@linux.ibm.com>
Thu, 14 Nov 2024 08:55:50 +0000 (09:55 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 29 Nov 2024 18:01:01 +0000 (19:01 +0100)
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)

providers/implementations/keymgmt/dsa_kmgmt.c

index 0b41e0a173efdb1dd93b2ad1e85377ed56034962..92f661b1f3ab0ac38514241ef2823a75abd16dbb 100644 (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;