aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-10-04 13:25:12 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-10-04 13:25:12 +0000
commit5d9ae88f58349022ee437fdf4dfc9e3a7f755beb (patch)
treeeaa66a90d9abeb791b72a83f719636fb85266941 /lib/ftp.c
parent9d066935e5e4e0d7477520eeb6fd7b82ce6bebc2 (diff)
getaddrinfo() cleanups
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 4fde25059..28e0479e7 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -906,7 +906,8 @@ CURLcode ftp_use_port(struct connectdata *conn)
2.1.X doesn't do*/
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
- if (getaddrinfo(hbuf, "0", &hints, &res))
+
+ if (getaddrinfo(hbuf, (char *)"0", &hints, &res))
return CURLE_FTP_PORT_FAILED;
portsock = -1;
@@ -929,16 +930,15 @@ CURLcode ftp_use_port(struct connectdata *conn)
break;
}
+ freeaddrinfo(res);
if (portsock < 0) {
failf(data, strerror(errno));
- freeaddrinfo(res);
return CURLE_FTP_PORT_FAILED;
}
sslen = sizeof(ss);
if (getsockname(portsock, sa, &sslen) < 0) {
failf(data, strerror(errno));
- freeaddrinfo(res);
return CURLE_FTP_PORT_FAILED;
}
@@ -1047,7 +1047,6 @@ CURLcode ftp_use_port(struct connectdata *conn)
if (!*modep) {
sclose(portsock);
- freeaddrinfo(res);
return CURLE_FTP_PORT_FAILED;
}
/* we set the secondary socket variable to this for now, it
@@ -1134,7 +1133,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
}
if(hostdataptr)
/* free the memory used for name lookup */
- free(hostdataptr);
+ Curl_freeaddrinfo(hostdataptr);
}
else {
failf(data, "could't find my own IP address (%s)", myhost);
@@ -1285,7 +1284,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
ftp_pasv_verbose(conn, conninfo, newhost, connectport);
if(hostdataptr)
- free(hostdataptr);
+ Curl_freeaddrinfo(hostdataptr);
if(CURLE_OK != result)
return result;