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/bio/bss_conn.c | |
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/bio/bss_conn.c')
-rw-r--r-- | crypto/bio/bss_conn.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index e44bb32dca..0b820820b8 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -148,8 +148,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) *q = '\0'; break; } - if (c->param_port != NULL) - OPENSSL_free(c->param_port); + OPENSSL_free(c->param_port); c->param_port = BUF_strdup(p); } } @@ -308,10 +307,8 @@ void BIO_CONNECT_free(BIO_CONNECT *a) if (a == NULL) return; - if (a->param_hostname != NULL) - OPENSSL_free(a->param_hostname); - if (a->param_port != NULL) - OPENSSL_free(a->param_port); + OPENSSL_free(a->param_hostname); + OPENSSL_free(a->param_port); OPENSSL_free(a); } @@ -455,12 +452,10 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) if (ptr != NULL) { b->init = 1; if (num == 0) { - if (data->param_hostname != NULL) - OPENSSL_free(data->param_hostname); + OPENSSL_free(data->param_hostname); data->param_hostname = BUF_strdup(ptr); } else if (num == 1) { - if (data->param_port != NULL) - OPENSSL_free(data->param_port); + OPENSSL_free(data->param_port); data->param_port = BUF_strdup(ptr); } else if (num == 2) { char buf[16]; @@ -468,16 +463,14 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) BIO_snprintf(buf, sizeof buf, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); - if (data->param_hostname != NULL) - OPENSSL_free(data->param_hostname); + OPENSSL_free(data->param_hostname); data->param_hostname = BUF_strdup(buf); memcpy(&(data->ip[0]), ptr, 4); } else if (num == 3) { char buf[DECIMAL_SIZE(int) + 1]; BIO_snprintf(buf, sizeof buf, "%d", *(int *)ptr); - if (data->param_port != NULL) - OPENSSL_free(data->param_port); + OPENSSL_free(data->param_port); data->param_port = BUF_strdup(buf); data->port = *(int *)ptr; } |