summaryrefslogtreecommitdiffstats
path: root/apps/gendsa.c
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2023-09-11 06:38:31 +0200
committerBernd Edlinger <bernd.edlinger@hotmail.de>2023-09-21 14:39:36 +0200
commit8c040c086ca11a519975c58961a5dc933aa6524a (patch)
tree3ba0ef6ed64669b4dc82a50ba3e6905913f3cb7d /apps/gendsa.c
parent080bd08fd32608b4f2edfa4b1e87e199b08a8835 (diff)
Fix some memory leaks in the openssl app
In some error cases the normal cleanup did not happen, but instead an exit(1) which caused some memory leaks, as reported in #22049. Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> (Merged from https://github.com/openssl/openssl/pull/22055)
Diffstat (limited to 'apps/gendsa.c')
-rw-r--r--apps/gendsa.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/gendsa.c b/apps/gendsa.c
index bd8aecedbd..b6d1d0f5b3 100644
--- a/apps/gendsa.c
+++ b/apps/gendsa.c
@@ -148,6 +148,8 @@ int gendsa_main(int argc, char **argv)
goto end;
}
pkey = app_keygen(ctx, "DSA", nbits, verbose);
+ if (pkey == NULL)
+ goto end;
assert(private);
if (!PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, passout)) {