dnsget

Michael Tokarev mjt at tls.msk.ru
Fri Sep 18 22:09:37 MSD 2009


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

Well, it's at the very end of main(), right before
return.  There's no need to free memory or close
filedescriptors there, since kernel will do that
all much quicker after exit - by freeing things
here we're just wasting (some small amount of) time.

And if you're about fixing "memory leaks" like this,
you can as well check all error returns.  Which is,
again, useless.

/mjt


More information about the udns mailing list