Fix coverity issue: CID 1466484 - Remove dead code in PKCS7_dataInit()
authorShane Lontis <shane.lontis@oracle.com>
Thu, 10 Sep 2020 07:30:02 +0000 (17:30 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Sat, 12 Sep 2020 05:57:24 +0000 (15:57 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12847)

crypto/pkcs7/pk7_doit.c

index 6a7af7826d46c0bff8b4849a1182292d9b0b5a1f..c48c629398e3744b62c6f0ce9a6cdec94587f892 100644 (file)
@@ -316,17 +316,12 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
         fetched_cipher = EVP_CIPHER_fetch(p7_ctx->libctx,
                                           EVP_CIPHER_name(evp_cipher),
                                           p7_ctx->propq);
+        (void)ERR_pop_to_mark();
         if (fetched_cipher != NULL)
             cipher = fetched_cipher;
         else
             cipher = evp_cipher;
 
-        if (cipher == NULL) {
-            (void)ERR_clear_last_mark();
-            goto err;
-        }
-        (void)ERR_pop_to_mark();
-
         if (EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, 1) <= 0)
             goto err;