From: Bernd Edlinger Date: Sun, 3 Dec 2023 10:24:18 +0000 (+0100) Subject: Fix a possible memleak in cms_main X-Git-Tag: openssl-3.0.13~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98c9595ca63115341d401d7fb62cf21058ad1a60;p=thirdparty%2Fopenssl.git Fix a possible memleak in cms_main Reviewed-by: Shane Lontis Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/22918) (cherry picked from commit 3457a550c64ab8009c7cd0175675ac140cab33c2) --- diff --git a/apps/cms.c b/apps/cms.c index 12095b9641c..3994cb0fcd5 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; } }