diff options
author | Rich Salz <rsalz@openssl.org> | 2015-05-01 10:02:07 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-05-01 10:02:07 -0400 |
commit | b548a1f11c06ccdfa4f52a539912d22d77ee309e (patch) | |
tree | 37ff8792ddf09e4805aa3ba76b805923d3c52734 /crypto/cms | |
parent | 33fbca83dcd05b77f807fab205c4523b8cfe85b5 (diff) |
free null cleanup finale
Don't check for NULL before calling OPENSSL_free
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/cms')
-rw-r--r-- | crypto/cms/cms_env.c | 9 | ||||
-rw-r--r-- | crypto/cms/cms_ess.c | 3 | ||||
-rw-r--r-- | crypto/cms/cms_kari.c | 5 | ||||
-rw-r--r-- | crypto/cms/cms_pwri.c | 2 | ||||
-rw-r--r-- | crypto/cms/cms_sd.c | 3 |
5 files changed, 9 insertions, 13 deletions
diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index d146f845e9..e8274beabf 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -404,8 +404,7 @@ static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, EVP_PKEY_CTX_free(pctx); ktri->pctx = NULL; } - if (ek) - OPENSSL_free(ek); + OPENSSL_free(ek); return ret; } @@ -472,7 +471,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, err: EVP_PKEY_CTX_free(ktri->pctx); ktri->pctx = NULL; - if (!ret && ek) + if (!ret) OPENSSL_free(ek); return ret; @@ -712,7 +711,7 @@ static int cms_RecipientInfo_kekri_encrypt(CMS_ContentInfo *cms, err: - if (!r && wkey) + if (!r) OPENSSL_free(wkey); OPENSSL_cleanse(&actx, sizeof(actx)); @@ -785,7 +784,7 @@ static int cms_RecipientInfo_kekri_decrypt(CMS_ContentInfo *cms, err: - if (!r && ukey) + if (!r) OPENSSL_free(ukey); OPENSSL_cleanse(&actx, sizeof(actx)); diff --git a/crypto/cms/cms_ess.c b/crypto/cms/cms_ess.c index 6d5fa90a06..21f41f6a4b 100644 --- a/crypto/cms/cms_ess.c +++ b/crypto/cms/cms_ess.c @@ -154,8 +154,7 @@ int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr) if (!r) CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE); - if (rrder) - OPENSSL_free(rrder); + OPENSSL_free(rrder); return r; diff --git a/crypto/cms/cms_kari.c b/crypto/cms/cms_kari.c index 17b62ddd8c..ea7fb5b8f2 100644 --- a/crypto/cms/cms_kari.c +++ b/crypto/cms/cms_kari.c @@ -268,7 +268,7 @@ static int cms_kek_cipher(unsigned char **pout, size_t *poutlen, err: OPENSSL_cleanse(kek, keklen); - if (!rv && out) + if (!rv) OPENSSL_free(out); EVP_CIPHER_CTX_cleanup(&kari->ctx); EVP_PKEY_CTX_free(kari->pctx); @@ -300,8 +300,7 @@ int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, cek = NULL; rv = 1; err: - if (cek) - OPENSSL_free(cek); + OPENSSL_free(cek); return rv; } diff --git a/crypto/cms/cms_pwri.c b/crypto/cms/cms_pwri.c index 64165022f3..1d505e9d1c 100644 --- a/crypto/cms/cms_pwri.c +++ b/crypto/cms/cms_pwri.c @@ -420,7 +420,7 @@ int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, EVP_CIPHER_CTX_cleanup(&kekctx); - if (!r && key) + if (!r) OPENSSL_free(key); X509_ALGOR_free(kekalg); diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index 31398acfe3..7fb4385f60 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -728,8 +728,7 @@ int CMS_SignerInfo_sign(CMS_SignerInfo *si) return 1; err: - if (abuf) - OPENSSL_free(abuf); + OPENSSL_free(abuf); EVP_MD_CTX_cleanup(mctx); return 0; |