[En-Nut-Discussion] NutDnsGetHostByName bug ?
Zodianet
zodianet at wanadoo.fr
Fri Feb 27 14:37:29 CET 2004
NutDnsGetHostByName (resolv.c) seems to not release correctly memory
alloc,
"doq->doq_name" in CreateDnsQuestion function.
A single but not very elegant test "if (doq->doq_name)
NutHeapFree(doq->doq_name)" seems suppress this bug.
Jean Pierre
static DNSQUESTION *CreateDnsQuestion(DNSQUESTION * doq,
CONST u_char * name)
{
if (doq == 0)
doq = NutHeapAllocClear(sizeof(DNSQUESTION));
if (doq) {
if (doq->doq_name) // <---------
NutHeapFree(doq->doq_name); // <----------
doq->doq_name = NutHeapAlloc(strlen(name) + 1);
strcpy(doq->doq_name, name);
doq->doq_type = 1;
doq->doq_class = 1;
}
More information about the En-Nut-Discussion
mailing list