If getaddrinfo fails, the linked list is not initialized. It must therefore
not be freed.
The error occurred when datafile was defined in sarg.conf and datafile_url
was set to ip (the default value).
Thanks to Evgeniy Yakushev for finding and reporting this bug.
#ifdef HAVE_GETADDRINFO
int error;
char *port;
- struct addrinfo *res;
+ struct addrinfo *res=NULL;
char *addr;
addr=name;
error=getaddrinfo(addr,NULL,NULL,&res);
if (error) {
- freeaddrinfo(res);
+ if (res) freeaddrinfo(res);
debuga(__FILE__,__LINE__,_("Cannot resolve host name %s: %s\n"),name,gai_strerror(error));
exit(EXIT_FAILURE);
}