mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Initialize h_alises with a length 1 array containing a terminating null as specified. Patch by arty. (Fixes ncftp connection)
svn path=/trunk/; revision=24209
This commit is contained in:
parent
f8fcca6f06
commit
14d0c5f34a
1 changed files with 16 additions and 5 deletions
|
@ -488,7 +488,10 @@ void populate_hostent(struct hostent *he, char* name, DNS_A_DATA addr)
|
|||
name,
|
||||
MAX_HOSTNAME_LEN);
|
||||
|
||||
he->h_aliases = 0;
|
||||
if( !he->h_aliases ) {
|
||||
he->h_aliases = HeapAlloc(GlobalHeap, 0, sizeof(char *));
|
||||
he->h_aliases[0] = 0;
|
||||
}
|
||||
he->h_addrtype = AF_INET;
|
||||
he->h_length = sizeof(IN_ADDR); //sizeof(struct in_addr);
|
||||
|
||||
|
@ -518,12 +521,20 @@ void free_hostent(struct hostent *he)
|
|||
{
|
||||
if(he)
|
||||
{
|
||||
char *next = 0;
|
||||
HFREE(he->h_name);
|
||||
char *next = he->h_aliases[0];
|
||||
while(next) { HFREE(next); next++; }
|
||||
next = he->h_addr_list[0];
|
||||
while(next) { HFREE(next); next++; }
|
||||
if(he->h_aliases)
|
||||
{
|
||||
next = he->h_aliases[0];
|
||||
while(next) { HFREE(next); next++; }
|
||||
}
|
||||
if(he->h_addr_list)
|
||||
{
|
||||
next = he->h_addr_list[0];
|
||||
while(next) { HFREE(next); next++; }
|
||||
}
|
||||
HFREE(he->h_addr_list);
|
||||
HFREE(he->h_aliases);
|
||||
HFREE(he);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue