In dnsget there is a memory leak before the return statement. dns_close needs to be done. Abhijit > dns_close(NULL); return errors ? 1 : notfound ? 100 : 0; }