Don't free the current addrinfo list, or else a pointer to a freed

memory area would arise.  Only an addrinfo list from an earlier
call to getaddrinfo() should be freed there because it will be
substituted by the current list referenced by "res".

Reported by:	John Long <fbsd1@pruam.com>
MFC after:	5 days
This commit is contained in:
yar 2002-11-11 07:31:48 +00:00
parent 78766a7b7a
commit e2616c6490

View File

@ -785,7 +785,7 @@ inithosts(void)
hrp->hostname = NULL;
insert = 1;
} else {
if (hrp->hostinfo)
if (hrp->hostinfo && hrp->hostinfo != res)
freeaddrinfo(hrp->hostinfo);
insert = 0; /* host already in the chain */
}