aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-11-05 10:51:41 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-11-05 10:51:41 +0000
commit2cff2518631fc538c127c1e94c47c743e2a64661 (patch)
treeaa0b3b2ff5b198878fc6df6128e5e4910ca7f879 /lib/ftp.c
parent73d996bf265b737e289a18635fb0b3e69d8d7403 (diff)
Curl_resolv() now returns a different struct, and it contains a reference
counter so that the caller needs to decrease that counter when done with the returned data. If compiled with MALLOCDEBUG I've added some extra checking that the counter is decreased before a handle is closed etc.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 9fe31b857..9e7e3a7d6 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1184,7 +1184,6 @@ CURLcode ftp_use_port(struct connectdata *conn)
*/
struct sockaddr_in sa;
struct hostent *h=NULL;
- char *hostdataptr=NULL;
unsigned short porttouse;
char myhost[256] = "";
bool sa_filled_in = FALSE;
@@ -1215,6 +1214,9 @@ CURLcode ftp_use_port(struct connectdata *conn)
sa_filled_in = TRUE; /* the sa struct is filled in */
}
+ if(h)
+ h->inuse--; /* when we return from here, we can forget about this */
+
if ( h || sa_filled_in) {
if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) {
int size;
@@ -1250,19 +1252,16 @@ CURLcode ftp_use_port(struct connectdata *conn)
if ( listen(portsock, 1) < 0 ) {
failf(data, "listen(2) failed on socket");
- free(hostdataptr);
return CURLE_FTP_PORT_FAILED;
}
}
else {
failf(data, "bind(2) failed on socket");
- free(hostdataptr);
return CURLE_FTP_PORT_FAILED;
}
}
else {
failf(data, "socket(2) failed (%s)");
- free(hostdataptr);
return CURLE_FTP_PORT_FAILED;
}
}
@@ -1332,7 +1331,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
char *buf = data->state.buffer; /* this is our buffer */
int ftpcode; /* receive FTP response codes in this */
CURLcode result;
- Curl_addrinfo *addr=NULL;
+ struct Curl_dns_entry *addr=NULL;
Curl_ipconnect *conninfo;
/*
@@ -1480,6 +1479,8 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
&conninfo,
connected);
+ addr->inuse--; /* we're done using this address */
+
/*
* When this is used from the multi interface, this might've returned with
* the 'connected' set to FALSE and thus we are now awaiting a non-blocking