From 068bf464df6ef084067943863d776f59762bfaf0 Mon Sep 17 00:00:00 2001 From: miod <> Date: Sat, 12 Jul 2014 16:03:37 +0000 Subject: if (x) FOO_free(x) -> FOO_free(x). Improves readability, keeps the code smaller so that it is warmer in your cache. review & ok deraadt@ --- src/lib/libcrypto/cms/cms_asn1.c | 8 +++----- src/lib/libcrypto/cms/cms_env.c | 8 +++----- src/lib/libcrypto/cms/cms_sd.c | 5 ++--- 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'src/lib/libcrypto/cms') diff --git a/src/lib/libcrypto/cms/cms_asn1.c b/src/lib/libcrypto/cms/cms_asn1.c index a75fa26137..fbdac5b1ba 100644 --- a/src/lib/libcrypto/cms/cms_asn1.c +++ b/src/lib/libcrypto/cms/cms_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_asn1.c,v 1.4 2014/06/12 15:49:28 deraadt Exp $ */ +/* $OpenBSD: cms_asn1.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -91,8 +91,7 @@ cms_si_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) { if (operation == ASN1_OP_FREE_POST) { CMS_SignerInfo *si = (CMS_SignerInfo *)*pval; - if (si->pkey) - EVP_PKEY_free(si->pkey); + EVP_PKEY_free(si->pkey); if (si->signer) X509_free(si->signer); } @@ -219,8 +218,7 @@ cms_ri_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) CMS_RecipientInfo *ri = (CMS_RecipientInfo *)*pval; if (ri->type == CMS_RECIPINFO_TRANS) { CMS_KeyTransRecipientInfo *ktri = ri->d.ktri; - if (ktri->pkey) - EVP_PKEY_free(ktri->pkey); + EVP_PKEY_free(ktri->pkey); if (ktri->recip) X509_free(ktri->recip); } else if (ri->type == CMS_RECIPINFO_KEK) { diff --git a/src/lib/libcrypto/cms/cms_env.c b/src/lib/libcrypto/cms/cms_env.c index 66ec1a9343..19c86b9550 100644 --- a/src/lib/libcrypto/cms/cms_env.c +++ b/src/lib/libcrypto/cms/cms_env.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_env.c,v 1.6 2014/07/11 08:44:48 jsing Exp $ */ +/* $OpenBSD: cms_env.c,v 1.7 2014/07/12 16:03:37 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -346,8 +346,7 @@ cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) ret = 1; err: - if (pctx) - EVP_PKEY_CTX_free(pctx); + EVP_PKEY_CTX_free(pctx); free(ek); return ret; } @@ -416,8 +415,7 @@ cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) ec->keylen = eklen; err: - if (pctx) - EVP_PKEY_CTX_free(pctx); + EVP_PKEY_CTX_free(pctx); if (!ret && ek) free(ek); diff --git a/src/lib/libcrypto/cms/cms_sd.c b/src/lib/libcrypto/cms/cms_sd.c index 7e490c0988..70ad897bda 100644 --- a/src/lib/libcrypto/cms/cms_sd.c +++ b/src/lib/libcrypto/cms/cms_sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_sd.c,v 1.7 2014/07/11 13:02:10 miod Exp $ */ +/* $OpenBSD: cms_sd.c,v 1.8 2014/07/12 16:03:37 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -495,8 +495,7 @@ CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer) { if (signer) { CRYPTO_add(&signer->references, 1, CRYPTO_LOCK_X509); - if (si->pkey) - EVP_PKEY_free(si->pkey); + EVP_PKEY_free(si->pkey); si->pkey = X509_get_pubkey(signer); } if (si->signer) -- cgit v1.2.3-55-g6feb