[En-Nut-Discussion] resolv.c Memory leak
Mike Cornelius
mikec at calldirect.com.au
Thu Apr 3 07:21:18 CEST 2003
Hi All,
I have found a memory leak in CreateDnsQuestion() in resolv.c
if(doq == 0)
doq = NutHeapAllocClear(sizeof(DNSQUESTION));
if(doq) {
doq->doq_name = NutHeapAlloc(strlen(name) + 1);
...
Should be :-
if(doq == 0)
doq = NutHeapAllocClear(sizeof(DNSQUESTION));
if(doq) {
if (doq->doq_name)
NutHeapFree(doq->doq_name);
doq->doq_name = NutHeapAlloc(strlen(name) + 1);
...
Or else if NutDnsGetHostByName() retries CreateDnsQuestion will leak...
Regards,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mike Cornelius Internet: mikec at calldirect.com.au
Call Direct Cellular Solutions Phone: +61 2 99-65-75-85
Level 1 8-22 West St North Sydney FAX: +61 2 99-65-75-90
NSW 2060 Australia URL: http://www.calldirect.com.au
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the En-Nut-Discussion
mailing list