1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=106754

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