aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/bio/b_sock.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2016-02-14 15:50:13 -0500
committerRich Salz <rsalz@openssl.org>2016-02-14 17:36:10 -0500
commitd9d8e7a9c150dea538ceffe4cac6140e46389986 (patch)
treeba7e0c838a047bb63868c4c13292b91c1a5e0e52 /crypto/bio/b_sock.c
parent0756592b60d7d2bcb64f7ca01ec1430c43b1cf26 (diff)
downloadopenssl-d9d8e7a9c150dea538ceffe4cac6140e46389986.tar.gz
Make the BIO_ADDR param optional.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/bio/b_sock.c')
-rw-r--r--crypto/bio/b_sock.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index eece85bb51..50bd27dabd 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -316,16 +316,10 @@ int BIO_get_accept_socket(char *host, int bind_mode)
int BIO_accept(int sock, char **ip_port)
{
- BIO_ADDR *res = BIO_ADDR_new();
+ BIO_ADDR res;
int ret = -1;
- if (res == NULL) {
- BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
- return ret;
- }
-
- ret = BIO_accept_ex(sock, res, 0);
-
+ ret = BIO_accept_ex(sock, &res, 0);
if (ret == (int)INVALID_SOCKET) {
if (BIO_sock_should_retry(ret)) {
ret = -2;
@@ -337,8 +331,8 @@ int BIO_accept(int sock, char **ip_port)
}
if (ip_port != NULL) {
- char *host = BIO_ADDR_hostname_string(res, 1);
- char *port = BIO_ADDR_service_string(res, 1);
+ char *host = BIO_ADDR_hostname_string(&res, 1);
+ char *port = BIO_ADDR_service_string(&res, 1);
*ip_port = OPENSSL_zalloc(strlen(host) + strlen(port) + 2);
strcpy(*ip_port, host);
strcat(*ip_port, ":");
@@ -348,7 +342,6 @@ int BIO_accept(int sock, char **ip_port)
}
end:
- BIO_ADDR_free(res);
return ret;
}
# endif