Skip to content
Snippets Groups Projects
Commit 8950a2df authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

*TERRIBLE* terrible memory leak occuring on all systems that have no

gethostbyname_r() function, most notably windows machines...
parent be47d835
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,8 @@ struct hostent *Curl_gethost(struct SessionHandle *data,
{
struct hostent *h = NULL;
unsigned long in;
#ifdef HAVE_GETHOSTBYNAME_R
int ret; /* this variable is unused on several platforms but used on some */
#define CURL_NAMELOOKUP_SIZE 9000
......@@ -136,7 +138,7 @@ struct hostent *Curl_gethost(struct SessionHandle *data,
if(!buf)
return NULL; /* major failure */
*bufp = buf;
#endif
ret = 0; /* to prevent the compiler warning */
if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
......@@ -206,10 +208,9 @@ struct hostent *Curl_gethost(struct SessionHandle *data,
}
#else
else {
*bufp=NULL; /* zero this always */
if ((h = gethostbyname(hostname)) == NULL ) {
infof(data, "gethostbyname(2) failed for %s\n", hostname);
free(buf);
*bufp=NULL;
}
#endif
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment