[PATCH v2 03/12] getaddrinfo: Fix leak with AI_ALL [BZ #28852]

Siddhesh Poyarekar siddhesh@sourceware.org
Thu Mar 17 02:30:59 GMT 2022


On 17/03/2022 05:12, DJ Delorie via Libc-alpha wrote:
> Siddhesh Poyarekar via Libc-alpha <libc-alpha@sourceware.org> writes:
>> Use realloc in convert_hostent_to_gaih_addrtuple and fix up pointers in
>> the result list so that a single block is maintained for
>> hostbyname3_r/hostbyname2_r and freed in gaih_inet.  This result is
>> never merged with any other results, since the hosts database does not
>> permit merging.
> 
> It took me a while to realize that you're basically converting the data
> structure from a linked list to an array, and ensuring that it's always
> handled as an array.  That means the comment preceeding
> convert_hostent_to_gaih_addrtuple() is no longer accurate and needs
> updating.  Ideally, the users could be optimized to treat it as an array
> instead of a list, but it may need to remain a list-like type for
> compatibility.

Thanks, I'll update the comment.

Thanks,
Siddhesh


More information about the Libc-alpha mailing list