summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asn1/asn_mime.c3
-rw-r--r--crypto/asn1/bio_asn1.c4
-rw-r--r--crypto/asn1/bio_ndef.c3
-rw-r--r--crypto/bio/bio_lib.c3
-rw-r--r--crypto/bio/bss_acpt.c12
-rw-r--r--crypto/bio/bss_bio.c12
-rw-r--r--crypto/bio/bss_conn.c6
-rw-r--r--crypto/cms/cms_lib.c3
-rw-r--r--crypto/cms/cms_sd.c3
-rw-r--r--crypto/cms/cms_smime.c8
-rw-r--r--crypto/dsa/dsatest.c6
-rw-r--r--crypto/ecdsa/ecdsatest.c3
-rw-r--r--crypto/ocsp/ocsp_ht.c3
-rw-r--r--crypto/pkcs7/pk7_doit.c29
-rw-r--r--crypto/srp/srp_vfy.c3
-rw-r--r--crypto/threads/mttest.c14
-rw-r--r--crypto/x509/by_file.c6
17 files changed, 42 insertions, 79 deletions
diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c
index e96fb02094..e810345579 100644
--- a/crypto/asn1/asn_mime.c
+++ b/crypto/asn1/asn_mime.c
@@ -650,8 +650,7 @@ static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
BIO_write(bpart, linebuf, len);
}
}
- if (bpart != NULL)
- BIO_free(bpart);
+ BIO_free(bpart);
return 0;
}
diff --git a/crypto/asn1/bio_asn1.c b/crypto/asn1/bio_asn1.c
index 0b4fd1dd9e..d4be23c190 100644
--- a/crypto/asn1/bio_asn1.c
+++ b/crypto/asn1/bio_asn1.c
@@ -179,8 +179,8 @@ static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
static int asn1_bio_free(BIO *b)
{
- BIO_ASN1_BUF_CTX *ctx;
- ctx = (BIO_ASN1_BUF_CTX *)b->ptr;
+ BIO_ASN1_BUF_CTX *ctx = (BIO_ASN1_BUF_CTX *)b->ptr;
+
if (ctx == NULL)
return 0;
if (ctx->buf)
diff --git a/crypto/asn1/bio_ndef.c b/crypto/asn1/bio_ndef.c
index 4a73ca9eac..1018787a63 100644
--- a/crypto/asn1/bio_ndef.c
+++ b/crypto/asn1/bio_ndef.c
@@ -142,8 +142,7 @@ BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
return sarg.ndef_bio;
err:
- if (asn_bio)
- BIO_free(asn_bio);
+ BIO_free(asn_bio);
if (ndef_aux)
OPENSSL_free(ndef_aux);
return NULL;
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index 11e0142de8..a5d8680d48 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -549,8 +549,7 @@ BIO *BIO_dup_chain(BIO *in)
}
return (ret);
err:
- if (ret != NULL)
- BIO_free(ret);
+ BIO_free(ret);
return (NULL);
}
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c
index 5aa06cf167..72f7bd21de 100644
--- a/crypto/bio/bss_acpt.c
+++ b/crypto/bio/bss_acpt.c
@@ -155,8 +155,7 @@ static void BIO_ACCEPT_free(BIO_ACCEPT *a)
OPENSSL_free(a->param_addr);
if (a->addr != NULL)
OPENSSL_free(a->addr);
- if (a->bio_chain != NULL)
- BIO_free(a->bio_chain);
+ BIO_free(a->bio_chain);
OPENSSL_free(a);
}
@@ -360,8 +359,7 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
} else if (num == 1) {
data->accept_nbio = (ptr != NULL);
} else if (num == 2) {
- if (data->bio_chain != NULL)
- BIO_free(data->bio_chain);
+ BIO_free(data->bio_chain);
data->bio_chain = (BIO *)ptr;
}
}
@@ -448,10 +446,8 @@ BIO *BIO_new_accept(const char *str)
return (NULL);
if (BIO_set_accept_port(ret, str))
return (ret);
- else {
- BIO_free(ret);
- return (NULL);
- }
+ BIO_free(ret);
+ return (NULL);
}
#endif
diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c
index d629a37a5a..c6bb3d6885 100644
--- a/crypto/bio/bss_bio.c
+++ b/crypto/bio/bss_bio.c
@@ -788,14 +788,10 @@ int BIO_new_bio_pair(BIO **bio1_p, size_t writebuf1,
err:
if (ret == 0) {
- if (bio1) {
- BIO_free(bio1);
- bio1 = NULL;
- }
- if (bio2) {
- BIO_free(bio2);
- bio2 = NULL;
- }
+ BIO_free(bio1);
+ bio1 = NULL;
+ BIO_free(bio2);
+ bio2 = NULL;
}
*bio1_p = bio1;
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c
index c7f57f1c7c..e95b4b38d6 100644
--- a/crypto/bio/bss_conn.c
+++ b/crypto/bio/bss_conn.c
@@ -588,10 +588,8 @@ BIO *BIO_new_connect(const char *str)
return (NULL);
if (BIO_set_conn_hostname(ret, str))
return (ret);
- else {
- BIO_free(ret);
- return (NULL);
- }
+ BIO_free(ret);
+ return (NULL);
}
#endif
diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c
index 7e1c1e8d94..6d2a0e8275 100644
--- a/crypto/cms/cms_lib.c
+++ b/crypto/cms/cms_lib.c
@@ -354,8 +354,7 @@ BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm)
}
return mdbio;
err:
- if (mdbio)
- BIO_free(mdbio);
+ BIO_free(mdbio);
return NULL;
}
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index b8ed1a1bea..c45d30eac1 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -806,8 +806,7 @@ BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms)
}
return chain;
err:
- if (chain)
- BIO_free_all(chain);
+ BIO_free_all(chain);
return NULL;
}
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c
index 6f6f20d63a..f491ec9e77 100644
--- a/crypto/cms/cms_smime.c
+++ b/crypto/cms/cms_smime.c
@@ -114,7 +114,7 @@ static int cms_copy_content(BIO *out, BIO *in, unsigned int flags)
r = 1;
err:
- if (tmpout && (tmpout != out))
+ if (tmpout != out)
BIO_free(tmpout);
return r;
@@ -446,14 +446,13 @@ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
if (tmpin != dcont)
BIO_free(tmpin);
} else {
-
if (dcont && (tmpin == dcont))
do_free_upto(cmsbio, dcont);
else
BIO_free_all(cmsbio);
}
- if (tmpout && out != tmpout)
+ if (out != tmpout)
BIO_free_all(tmpout);
if (cms_certs)
@@ -580,8 +579,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
r = 1;
err:
- if (rct_cont)
- BIO_free(rct_cont);
+ BIO_free(rct_cont);
if (r)
return cms;
CMS_ContentInfo_free(cms);
diff --git a/crypto/dsa/dsatest.c b/crypto/dsa/dsatest.c
index bf47816037..a5d40f1eb6 100644
--- a/crypto/dsa/dsatest.c
+++ b/crypto/dsa/dsatest.c
@@ -218,10 +218,8 @@ int main(int argc, char **argv)
ERR_remove_thread_state(NULL);
ERR_free_strings();
CRYPTO_mem_leaks(bio_err);
- if (bio_err != NULL) {
- BIO_free(bio_err);
- bio_err = NULL;
- }
+ BIO_free(bio_err);
+ bio_err = NULL;
# ifdef OPENSSL_SYS_NETWARE
if (!ret)
printf("ERROR\n");
diff --git a/crypto/ecdsa/ecdsatest.c b/crypto/ecdsa/ecdsatest.c
index c2132da882..346ccd053f 100644
--- a/crypto/ecdsa/ecdsatest.c
+++ b/crypto/ecdsa/ecdsatest.c
@@ -563,8 +563,7 @@ int main(void)
ERR_remove_thread_state(NULL);
ERR_free_strings();
CRYPTO_mem_leaks(out);
- if (out != NULL)
- BIO_free(out);
+ BIO_free(out);
return ret;
}
#endif
diff --git a/crypto/ocsp/ocsp_ht.c b/crypto/ocsp/ocsp_ht.c
index aca0d48879..4a06a8e1ef 100644
--- a/crypto/ocsp/ocsp_ht.c
+++ b/crypto/ocsp/ocsp_ht.c
@@ -136,8 +136,7 @@ OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline)
void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
{
- if (rctx->mem)
- BIO_free(rctx->mem);
+ BIO_free(rctx->mem);
if (rctx->iobuf)
OPENSSL_free(rctx->iobuf);
OPENSSL_free(rctx);
diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c
index f77326b883..b7c66a3160 100644
--- a/crypto/pkcs7/pk7_doit.c
+++ b/crypto/pkcs7/pk7_doit.c
@@ -128,8 +128,7 @@ static int PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg)
return 1;
err:
- if (btmp)
- BIO_free(btmp);
+ BIO_free(btmp);
return 0;
}
@@ -390,16 +389,12 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
BIO_push(out, bio);
else
out = bio;
- bio = NULL;
- if (0) {
+ return out;
+
err:
- if (out != NULL)
- BIO_free_all(out);
- if (btmp != NULL)
- BIO_free_all(btmp);
- out = NULL;
- }
- return (out);
+ BIO_free_all(out);
+ BIO_free_all(btmp);
+ return NULL;
}
static int pkcs7_cmp_ri(PKCS7_RECIP_INFO *ri, X509 *pcert)
@@ -637,14 +632,10 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
OPENSSL_cleanse(tkey, tkeylen);
OPENSSL_free(tkey);
}
- if (out != NULL)
- BIO_free_all(out);
- if (btmp != NULL)
- BIO_free_all(btmp);
- if (etmp != NULL)
- BIO_free_all(etmp);
- if (bio != NULL)
- BIO_free_all(bio);
+ BIO_free_all(out);
+ BIO_free_all(btmp);
+ BIO_free_all(etmp);
+ BIO_free_all(bio);
out = NULL;
}
return (out);
diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c
index 9d83a8f606..82b9a77b14 100644
--- a/crypto/srp/srp_vfy.c
+++ b/crypto/srp/srp_vfy.c
@@ -460,8 +460,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
if (tmpdb)
TXT_DB_free(tmpdb);
- if (in)
- BIO_free_all(in);
+ BIO_free_all(in);
sk_SRP_gN_free(SRP_gN_tab);
diff --git a/crypto/threads/mttest.c b/crypto/threads/mttest.c
index ea3784c72f..f6f8df289c 100644
--- a/crypto/threads/mttest.c
+++ b/crypto/threads/mttest.c
@@ -612,15 +612,11 @@ int doit(char *ctx[4])
}
/* The SSL's are optionally freed in the following calls */
- if (c_to_s != NULL)
- BIO_free(c_to_s);
- if (s_to_c != NULL)
- BIO_free(s_to_c);
-
- if (c_bio != NULL)
- BIO_free(c_bio);
- if (s_bio != NULL)
- BIO_free(s_bio);
+ BIO_free(c_to_s);
+ BIO_free(s_to_c);
+
+ BIO_free(c_bio);
+ BIO_free(s_bio);
return (0);
}
diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c
index 43a073003d..bc1c90cc64 100644
--- a/crypto/x509/by_file.c
+++ b/crypto/x509/by_file.c
@@ -176,8 +176,7 @@ int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type)
err:
if (x != NULL)
X509_free(x);
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
return (ret);
}
@@ -235,8 +234,7 @@ int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type)
err:
if (x != NULL)
X509_CRL_free(x);
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
return (ret);
}