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:46:00 +0100
commit98c9595ca63115341d401d7fb62cf21058ad1a60 (patch)
treecaaf2651b5409f1b356ca8ecde204c470c8a6a61 /apps
parent4f41e1b1d0cd545278017099b4ba062ab7a0f470 (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) (cherry picked from commit 3457a550c64ab8009c7cd0175675ac140cab33c2)
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 12095b9641..3994cb0fcd 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -620,7 +620,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();
@@ -831,7 +832,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;
}
}