aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-09-12 07:19:11 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-09-12 07:19:11 +0000
commit8950a2dfa1c9f4dda56624a0813c860df561b97e (patch)
treee056f84d968ce3246988a6c215c1c37e9ee90881 /lib
parentbe47d835556ed56679b11b0cc74132759d07da05 (diff)
*TERRIBLE* terrible memory leak occuring on all systems that have no
gethostbyname_r() function, most notably windows machines...
Diffstat (limited to 'lib')
-rw-r--r--lib/hostip.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 8526fb91c..be365d45f 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -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
}