diff options
Diffstat (limited to 'crypto/cms')
-rw-r--r-- | crypto/cms/cms_cd.c | 5 | ||||
-rw-r--r-- | crypto/cms/cms_dd.c | 5 | ||||
-rw-r--r-- | crypto/cms/cms_enc.c | 2 | ||||
-rw-r--r-- | crypto/cms/cms_env.c | 9 | ||||
-rw-r--r-- | crypto/cms/cms_ess.c | 13 | ||||
-rw-r--r-- | crypto/cms/cms_kari.c | 7 | ||||
-rw-r--r-- | crypto/cms/cms_smime.c | 6 |
7 files changed, 14 insertions, 33 deletions
diff --git a/crypto/cms/cms_cd.c b/crypto/cms/cms_cd.c index aa3238f584..8673e00646 100644 --- a/crypto/cms/cms_cd.c +++ b/crypto/cms/cms_cd.c @@ -105,10 +105,7 @@ CMS_ContentInfo *cms_CompressedData_create(int comp_nid) return cms; err: - - if (cms) - CMS_ContentInfo_free(cms); - + CMS_ContentInfo_free(cms); return NULL; } diff --git a/crypto/cms/cms_dd.c b/crypto/cms/cms_dd.c index d5fda1a5c3..09ad319b87 100644 --- a/crypto/cms/cms_dd.c +++ b/crypto/cms/cms_dd.c @@ -88,10 +88,7 @@ CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md) return cms; err: - - if (cms) - CMS_ContentInfo_free(cms); - + CMS_ContentInfo_free(cms); return NULL; } diff --git a/crypto/cms/cms_enc.c b/crypto/cms/cms_enc.c index f1ac1d535b..ed20c53617 100644 --- a/crypto/cms/cms_enc.c +++ b/crypto/cms/cms_enc.c @@ -194,7 +194,7 @@ BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) ok = 1; err: - if (ec->key && !keep_key) { + if (!keep_key) { OPENSSL_clear_free(ec->key, ec->keylen); ec->key = NULL; } diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index e8274beabf..7fefd246e3 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -168,8 +168,7 @@ CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher) goto merr; return cms; merr: - if (cms) - CMS_ContentInfo_free(cms); + CMS_ContentInfo_free(cms); CMSerr(CMS_F_CMS_ENVELOPEDDATA_CREATE, ERR_R_MALLOC_FAILURE); return NULL; } @@ -400,10 +399,8 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, ret = 1; err: - if (pctx) { - EVP_PKEY_CTX_free(pctx); - ktri->pctx = NULL; - } + EVP_PKEY_CTX_free(pctx); + ktri->pctx = NULL; OPENSSL_free(ek); return ret; diff --git a/crypto/cms/cms_ess.c b/crypto/cms/cms_ess.c index 21f41f6a4b..9dfbd67e5f 100644 --- a/crypto/cms/cms_ess.c +++ b/crypto/cms/cms_ess.c @@ -128,9 +128,7 @@ CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, CMSerr(CMS_F_CMS_RECEIPTREQUEST_CREATE0, ERR_R_MALLOC_FAILURE); err: - if (rr) - CMS_ReceiptRequest_free(rr); - + CMS_ReceiptRequest_free(rr); return NULL; } @@ -337,10 +335,8 @@ int cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms) r = 1; err: - if (rr) - CMS_ReceiptRequest_free(rr); + CMS_ReceiptRequest_free(rr); M_ASN1_free_of(rct, CMS_Receipt); - return r; } @@ -384,9 +380,6 @@ ASN1_OCTET_STRING *cms_encode_Receipt(CMS_SignerInfo *si) os = ASN1_item_pack(&rct, ASN1_ITEM_rptr(CMS_Receipt), NULL); err: - if (rr) - CMS_ReceiptRequest_free(rr); - + CMS_ReceiptRequest_free(rr); return os; - } diff --git a/crypto/cms/cms_kari.c b/crypto/cms/cms_kari.c index ea7fb5b8f2..d860f0927d 100644 --- a/crypto/cms/cms_kari.c +++ b/crypto/cms/cms_kari.c @@ -207,10 +207,9 @@ int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk) { EVP_PKEY_CTX *pctx; CMS_KeyAgreeRecipientInfo *kari = ri->d.kari; - if (kari->pctx) { - EVP_PKEY_CTX_free(kari->pctx); - kari->pctx = NULL; - } + + EVP_PKEY_CTX_free(kari->pctx); + kari->pctx = NULL; if (!pk) return 1; pctx = EVP_PKEY_CTX_new(pk, NULL); diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index 8066602c9f..d19ec6d02c 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -512,8 +512,7 @@ CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, CMSerr(CMS_F_CMS_SIGN, ERR_R_MALLOC_FAILURE); err: - if (cms) - CMS_ContentInfo_free(cms); + CMS_ContentInfo_free(cms); return NULL; } @@ -614,8 +613,7 @@ CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *data, merr: CMSerr(CMS_F_CMS_ENCRYPT, ERR_R_MALLOC_FAILURE); err: - if (cms) - CMS_ContentInfo_free(cms); + CMS_ContentInfo_free(cms); return NULL; } |