summaryrefslogtreecommitdiffstats
path: root/apps/genpkey.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/genpkey.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/genpkey.c')
-rw-r--r--apps/genpkey.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/genpkey.c b/apps/genpkey.c
index 5a59dae681..080f1f6075 100644
--- a/apps/genpkey.c
+++ b/apps/genpkey.c
@@ -234,6 +234,8 @@ int genpkey_main(int argc, char **argv)
pkey = do_param ? app_paramgen(ctx, algname)
: app_keygen(ctx, algname, 0, 0 /* not verbose */);
+ if (pkey == NULL)
+ goto end;
if (do_param) {
rv = PEM_write_bio_Parameters(out, pkey);