gethostbyname_r() function, most notably windows machines...
{
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
if(!buf)
return NULL; /* major failure */
*bufp = buf;
-
+#endif
ret = 0; /* to prevent the compiler warning */
if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
}
#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
}