Loading lib/connect.c +2 −2 Original line number Diff line number Diff line Loading @@ -249,8 +249,8 @@ static CURLcode bindlocal(struct connectdata *conn, if ( h ) { Curl_addrinfo *addr = h->addr; h->inuse--; /* decrease the use-counter, we don't need it anymore after this function has returned */ Curl_resolv_unlock(h); /* we don't need it anymore after this function has returned */ memset((char *)&sa, 0, sizeof(sa)); #ifdef ENABLE_IPV6 Loading lib/ftp.c +3 −2 Original line number Diff line number Diff line Loading @@ -1215,7 +1215,8 @@ CURLcode ftp_use_port(struct connectdata *conn) } if(h) h->inuse--; /* when we return from here, we can forget about this */ /* when we return from here, we can forget about this */ Curl_resolv_unlock(h); if ( h || sa_filled_in) { if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) { Loading Loading @@ -1479,7 +1480,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn, &conninfo, connected); addr->inuse--; /* we're done using this address */ Curl_resolv_unlock(addr); /* we're done using this address */ /* * When this is used from the multi interface, this might've returned with Loading lib/hostip.h +11 −0 Original line number Diff line number Diff line Loading @@ -46,10 +46,21 @@ struct Curl_dns_entry { #endif }; /* * Curl_resolv() returns an entry with the info for the specified host * and port. * * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after * use, or we'll leak memory! */ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data, char *hostname, int port); /* unlock a previously resolved dns entry */ #define Curl_resolv_unlock(dns) dns->inuse-- /* for debugging purposes only: */ void Curl_scan_cache_used(void *user, void *ptr); Loading lib/url.c +2 −2 Original line number Diff line number Diff line Loading @@ -1500,7 +1500,7 @@ static int handleSock5Proxy( socksreq[6] = ((char*)hp->h_addr_list[0])[2]; socksreq[7] = ((char*)hp->h_addr_list[0])[3]; dns->inuse--; /* not used anymore from now on */ Curl_resolv_unlock(dns); /* not used anymore from now on */ } else { failf(conn->data, "Failed to resolve \"%s\" for SOCKS5 connect.", Loading Loading @@ -2852,7 +2852,7 @@ CURLcode Curl_done(struct connectdata *conn) } if(conn->connect_addr) conn->connect_addr->inuse--; /* done with this */ Curl_resolv_unlock(conn->connect_addr); /* done with this */ #ifdef MALLOCDEBUG /* scan for DNS cache entries still marked as in use */ Loading Loading
lib/connect.c +2 −2 Original line number Diff line number Diff line Loading @@ -249,8 +249,8 @@ static CURLcode bindlocal(struct connectdata *conn, if ( h ) { Curl_addrinfo *addr = h->addr; h->inuse--; /* decrease the use-counter, we don't need it anymore after this function has returned */ Curl_resolv_unlock(h); /* we don't need it anymore after this function has returned */ memset((char *)&sa, 0, sizeof(sa)); #ifdef ENABLE_IPV6 Loading
lib/ftp.c +3 −2 Original line number Diff line number Diff line Loading @@ -1215,7 +1215,8 @@ CURLcode ftp_use_port(struct connectdata *conn) } if(h) h->inuse--; /* when we return from here, we can forget about this */ /* when we return from here, we can forget about this */ Curl_resolv_unlock(h); if ( h || sa_filled_in) { if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) { Loading Loading @@ -1479,7 +1480,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn, &conninfo, connected); addr->inuse--; /* we're done using this address */ Curl_resolv_unlock(addr); /* we're done using this address */ /* * When this is used from the multi interface, this might've returned with Loading
lib/hostip.h +11 −0 Original line number Diff line number Diff line Loading @@ -46,10 +46,21 @@ struct Curl_dns_entry { #endif }; /* * Curl_resolv() returns an entry with the info for the specified host * and port. * * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after * use, or we'll leak memory! */ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data, char *hostname, int port); /* unlock a previously resolved dns entry */ #define Curl_resolv_unlock(dns) dns->inuse-- /* for debugging purposes only: */ void Curl_scan_cache_used(void *user, void *ptr); Loading
lib/url.c +2 −2 Original line number Diff line number Diff line Loading @@ -1500,7 +1500,7 @@ static int handleSock5Proxy( socksreq[6] = ((char*)hp->h_addr_list[0])[2]; socksreq[7] = ((char*)hp->h_addr_list[0])[3]; dns->inuse--; /* not used anymore from now on */ Curl_resolv_unlock(dns); /* not used anymore from now on */ } else { failf(conn->data, "Failed to resolve \"%s\" for SOCKS5 connect.", Loading Loading @@ -2852,7 +2852,7 @@ CURLcode Curl_done(struct connectdata *conn) } if(conn->connect_addr) conn->connect_addr->inuse--; /* done with this */ Curl_resolv_unlock(conn->connect_addr); /* done with this */ #ifdef MALLOCDEBUG /* scan for DNS cache entries still marked as in use */ Loading