summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2023-12-03 11:24:18 +0100
committerTomas Mraz <tomas@openssl.org>2023-12-12 19:45:09 +0100
commit3457a550c64ab8009c7cd0175675ac140cab33c2 (patch)
tree7c75cfcf8940390695737083f40a5699d13b61c9 /apps
parenta36d10dfb7e77614c8d3da602ff3800a2e9f4989 (diff)
Fix a possible memleak in cms_main
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22918)
Diffstat (limited to 'apps')
-rw-r--r--apps/cms.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/cms.c b/apps/cms.c
index a16318f37c..f93c98ac92 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -628,7 +628,8 @@ int cms_main(int argc, char **argv)
"recipient certificate file");
if (cert == NULL)
goto end;
- sk_X509_push(encerts, cert);
+ if (!sk_X509_push(encerts, cert))
+ goto end;
cert = NULL;
} else {
recipfile = opt_arg();
@@ -837,7 +838,8 @@ int cms_main(int argc, char **argv)
"recipient certificate file");
if (cert == NULL)
goto end;
- sk_X509_push(encerts, cert);
+ if (!sk_X509_push(encerts, cert))
+ goto end;
cert = NULL;
}
}