diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-05-30 06:22:58 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-05-30 06:22:58 +0000 |
commit | 92fe7f51d198ea62cc552bf356ca8d58fa48417f (patch) | |
tree | b9cbba44945fc3ef0c4bbbd4778edfff3328f155 /lib/libcrypto/bio | |
parent | 5e5527b3e65377286505a3ba5f9a7f0fa64f00f1 (diff) |
more: no need for null check before free
ok tedu guenther
Diffstat (limited to 'lib/libcrypto/bio')
-rw-r--r-- | lib/libcrypto/bio/b_sock.c | 3 | ||||
-rw-r--r-- | lib/libcrypto/bio/bf_buff.c | 9 | ||||
-rw-r--r-- | lib/libcrypto/bio/bf_lbuf.c | 3 | ||||
-rw-r--r-- | lib/libcrypto/bio/bf_nbio.c | 3 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_acpt.c | 9 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_bio.c | 6 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_conn.c | 21 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_dgram.c | 6 |
8 files changed, 19 insertions, 41 deletions
diff --git a/lib/libcrypto/bio/b_sock.c b/lib/libcrypto/bio/b_sock.c index a9c4408a093..c7a10ca3482 100644 --- a/lib/libcrypto/bio/b_sock.c +++ b/lib/libcrypto/bio/b_sock.c @@ -435,8 +435,7 @@ again: } ret = 1; err: - if (str != NULL) - free(str); + free(str); if ((ret == 0) && (s != -1)) { close(s); s = -1; diff --git a/lib/libcrypto/bio/bf_buff.c b/lib/libcrypto/bio/bf_buff.c index e96da40a58a..0866c8c7a3e 100644 --- a/lib/libcrypto/bio/bf_buff.c +++ b/lib/libcrypto/bio/bf_buff.c @@ -130,10 +130,8 @@ buffer_free(BIO *a) if (a == NULL) return (0); b = (BIO_F_BUFFER_CTX *)a->ptr; - if (b->ibuf != NULL) - free(b->ibuf); - if (b->obuf != NULL) - free(b->obuf); + free(b->ibuf); + free(b->obuf); free(a->ptr); a->ptr = NULL; a->init = 0; @@ -342,8 +340,7 @@ buffer_ctrl(BIO *b, int cmd, long num, void *ptr) p1 = malloc((int)num); if (p1 == NULL) goto malloc_error; - if (ctx->ibuf != NULL) - free(ctx->ibuf); + free(ctx->ibuf); ctx->ibuf = p1; } ctx->ibuf_off = 0; diff --git a/lib/libcrypto/bio/bf_lbuf.c b/lib/libcrypto/bio/bf_lbuf.c index 54c370d0380..42c0e1dca59 100644 --- a/lib/libcrypto/bio/bf_lbuf.c +++ b/lib/libcrypto/bio/bf_lbuf.c @@ -131,8 +131,7 @@ linebuffer_free(BIO *a) if (a == NULL) return (0); b = (BIO_LINEBUFFER_CTX *)a->ptr; - if (b->obuf != NULL) - free(b->obuf); + free(b->obuf); free(a->ptr); a->ptr = NULL; a->init = 0; diff --git a/lib/libcrypto/bio/bf_nbio.c b/lib/libcrypto/bio/bf_nbio.c index 5a0f6b276a5..9b0ec7d41f9 100644 --- a/lib/libcrypto/bio/bf_nbio.c +++ b/lib/libcrypto/bio/bf_nbio.c @@ -119,8 +119,7 @@ nbiof_free(BIO *a) { if (a == NULL) return (0); - if (a->ptr != NULL) - free(a->ptr); + free(a->ptr); a->ptr = NULL; a->init = 0; a->flags = 0; diff --git a/lib/libcrypto/bio/bss_acpt.c b/lib/libcrypto/bio/bss_acpt.c index 943d3d9d961..d246aba6814 100644 --- a/lib/libcrypto/bio/bss_acpt.c +++ b/lib/libcrypto/bio/bss_acpt.c @@ -148,10 +148,8 @@ BIO_ACCEPT_free(BIO_ACCEPT *a) if (a == NULL) return; - if (a->param_addr != NULL) - free(a->param_addr); - if (a->addr != NULL) - free(a->addr); + free(a->param_addr); + free(a->addr); if (a->bio_chain != NULL) BIO_free(a->bio_chain); free(a); @@ -352,8 +350,7 @@ acpt_ctrl(BIO *b, int cmd, long num, void *ptr) if (ptr != NULL) { if (num == 0) { b->init = 1; - if (data->param_addr != NULL) - free(data->param_addr); + free(data->param_addr); data->param_addr = BUF_strdup(ptr); } else if (num == 1) { data->accept_nbio = (ptr != NULL); diff --git a/lib/libcrypto/bio/bss_bio.c b/lib/libcrypto/bio/bss_bio.c index eda2e2a55c2..519002beed7 100644 --- a/lib/libcrypto/bio/bss_bio.c +++ b/lib/libcrypto/bio/bss_bio.c @@ -160,12 +160,8 @@ bio_free(BIO *bio) if (b->peer) bio_destroy_pair(bio); - if (b->buf != NULL) { - free(b->buf); - } - + free(b->buf); free(b); - return 1; } diff --git a/lib/libcrypto/bio/bss_conn.c b/lib/libcrypto/bio/bss_conn.c index 7ed8f1fe31e..a31e5a170bb 100644 --- a/lib/libcrypto/bio/bss_conn.c +++ b/lib/libcrypto/bio/bss_conn.c @@ -147,8 +147,7 @@ conn_state(BIO *b, BIO_CONNECT *c) *q = '\0'; break; } - if (c->param_port != NULL) - free(c->param_port); + free(c->param_port); c->param_port = BUF_strdup(p); } } @@ -315,10 +314,8 @@ BIO_CONNECT_free(BIO_CONNECT *a) if (a == NULL) return; - if (a->param_hostname != NULL) - free(a->param_hostname); - if (a->param_port != NULL) - free(a->param_port); + free(a->param_hostname); + free(a->param_port); free(a); } @@ -469,12 +466,10 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) if (ptr != NULL) { b->init = 1; if (num == 0) { - if (data->param_hostname != NULL) - free(data->param_hostname); + free(data->param_hostname); data->param_hostname = BUF_strdup(ptr); } else if (num == 1) { - if (data->param_port != NULL) - free(data->param_port); + free(data->param_port); data->param_port = BUF_strdup(ptr); } else if (num == 2) { char buf[16]; @@ -482,8 +477,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) snprintf(buf, sizeof buf, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); - if (data->param_hostname != NULL) - free(data->param_hostname); + free(data->param_hostname); data->param_hostname = BUF_strdup(buf); memcpy(&(data->ip[0]), ptr, 4); } else if (num == 3) { @@ -491,8 +485,7 @@ conn_ctrl(BIO *b, int cmd, long num, void *ptr) snprintf(buf, sizeof buf, "%d", *(int *)ptr); - if (data->param_port != NULL) - free(data->param_port); + free(data->param_port); data->param_port = BUF_strdup(buf); data->port= *(int *)ptr; } diff --git a/lib/libcrypto/bio/bss_dgram.c b/lib/libcrypto/bio/bss_dgram.c index 8f7439c51e6..9160fe40186 100644 --- a/lib/libcrypto/bio/bss_dgram.c +++ b/lib/libcrypto/bio/bss_dgram.c @@ -217,8 +217,7 @@ dgram_free(BIO *a) return 0; data = (bio_dgram_data *)a->ptr; - if (data != NULL) - free(data); + free(data); return (1); } @@ -830,8 +829,7 @@ dgram_sctp_free(BIO *a) return 0; data = (bio_dgram_sctp_data *)a->ptr; - if (data != NULL) - free(data); + free(data); return (1); } |