diff options
Diffstat (limited to 'src/crypto/bio/connect.c')
-rw-r--r-- | src/crypto/bio/connect.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/crypto/bio/connect.c b/src/crypto/bio/connect.c index cbb1bb6..32361bf 100644 --- a/src/crypto/bio/connect.c +++ b/src/crypto/bio/connect.c @@ -161,9 +161,7 @@ static int conn_state(BIO *bio, BIO_CONNECT *c) { break; } } - if (c->param_port != NULL) { - OPENSSL_free(c->param_port); - } + OPENSSL_free(c->param_port); c->param_port = BUF_strdup(p); } } @@ -286,12 +284,8 @@ static void BIO_CONNECT_free(BIO_CONNECT *c) { return; } - if (c->param_hostname != NULL) { - OPENSSL_free(c->param_hostname); - } - if (c->param_port != NULL) { - OPENSSL_free(c->param_port); - } + OPENSSL_free(c->param_hostname); + OPENSSL_free(c->param_port); OPENSSL_free(c); } @@ -397,10 +391,11 @@ static long conn_ctrl(BIO *bio, int cmd, long num, void *ptr) { break; case BIO_C_DO_STATE_MACHINE: /* use this one to start the connection */ - if (data->state != BIO_CONN_S_OK) + if (data->state != BIO_CONN_S_OK) { ret = (long)conn_state(bio, data); - else + } else { ret = 1; + } break; case BIO_C_GET_CONNECT: /* TODO(fork): can this be removed? (Or maybe this whole file). */ @@ -425,15 +420,17 @@ static long conn_ctrl(BIO *bio, int cmd, long num, void *ptr) { if (ptr != NULL) { bio->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); + if (data->param_hostname == NULL) { + ret = 0; } + } else if (num == 1) { + OPENSSL_free(data->param_port); data->param_port = BUF_strdup(ptr); + if (data->param_port == NULL) { + ret = 0; + } } else { ret = 0; } |