GetHost() now sets the third pointer to NULL when the lookup fails, as the
memory is then freed in the function
This commit is contained in:
@@ -187,12 +187,14 @@ struct hostent *GetHost(struct UrlData *data,
|
|||||||
infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
|
infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
|
||||||
h = NULL; /* set return code to NULL */
|
h = NULL; /* set return code to NULL */
|
||||||
free(buf);
|
free(buf);
|
||||||
|
*bufp=NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
else {
|
else {
|
||||||
if ((h = gethostbyname(hostname)) == NULL ) {
|
if ((h = gethostbyname(hostname)) == NULL ) {
|
||||||
infof(data, "gethostbyname(2) failed for %s\n", hostname);
|
infof(data, "gethostbyname(2) failed for %s\n", hostname);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
*bufp=NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user