[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

res_nsearch memory leaks



Hi,

I've been doing some testing with valgrind. It looks like the res_nsearch
API is leaking memory on my system. From doing a little Googling this
is apparently because some OSs do not supply the required res_ndestroy
function? Does anyone have further info?

Also, it seems the below is inconsistent. If res_ndestroy is called in
the error condition should it not be called outside the do/while?

    549         if (len < 0) {
    550 #ifdef HAVE_RES_NSEARCH
    551 #ifdef HAVE_RES_NDESTROY
    552             res_ndestroy(&state);
    553 #else
    554             res_nclose(&state);
    555 #endif
    556 #endif
    557             free(reply);
    558             return NULL;
    559         }
    560     } while (size < len && len < rk_DNS_MAX_PACKET_SIZE);
    561 #ifdef HAVE_RES_NSEARCH
    562     res_nclose(&state);
    563 #endif
    564
    565     len = min(len, size);
    566     r = parse_reply(reply, len);
    567     free(reply);
    568     return r;
    569 }

Mike

-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/