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:
Yaroslav Tykhiy 2002-11-11 07:31:48 +00:00
parent 6372d61e3e
commit 1f75c13ee0

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 */
}