aboutsummaryrefslogtreecommitdiff
path: root/crypto/bio
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-03-25 11:31:18 -0400
committerRich Salz <rsalz@openssl.org>2015-03-25 11:31:18 -0400
commitca3a82c3b364e1e584546f0f3bbb938b0b472580 (patch)
tree06c73d297f19629c1bf56bbf06dd2d443d4ac78f /crypto/bio
parent2011b169fa90edd4d986e7dbbd3d64587d316a22 (diff)
downloadopenssl-ca3a82c3b364e1e584546f0f3bbb938b0b472580.zip
openssl-ca3a82c3b364e1e584546f0f3bbb938b0b472580.tar.gz
openssl-ca3a82c3b364e1e584546f0f3bbb938b0b472580.tar.bz2
free NULL cleanup
This commit handles BIO_ACCEPT_free BIO_CB_FREE BIO_CONNECT_free BIO_free BIO_free_all BIO_vfree Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/bio')
-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
4 files changed, 11 insertions, 22 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index 11e0142..a5d8680 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 5aa06cf..72f7bd2 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 d629a37..c6bb3d6 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 c7f57f1..e95b4b3 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