Fix a possible memleak in smime_main
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 3 Dec 2023 10:34:37 +0000 (11:34 +0100)
committerTomas Mraz <tomas@openssl.org>
Tue, 12 Dec 2023 18:47:40 +0000 (19:47 +0100)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22919)

(cherry picked from commit ba4d833f6e24a83bc3e74ba55f52d8916b70fb59)

apps/smime.c

index a2ff0b5be75c834894be863a74155e1f09b39f68..52b4a01c232f9f1d1b44eb5279ec6b929b996602 100644 (file)
@@ -453,7 +453,8 @@ int smime_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;
             argv++;
         }