[PATCH] res_query: fix for CNAME responses on A queries.

Rob Landley rob at landley.net
Fri Nov 27 20:45:49 UTC 2009


On Friday 27 November 2009 11:45:50 Kevin Day wrote:
> I was looking at uClibc 0.9.28.3 to try and apply this patch and noticed:
>
> At the very end of your patch, the untouched code only has
> free(packet); while 0.9.28.3 has:
>         if (packet)
>                 free(packet);
>
> Does anybody know why was this safety check removed?

From the Single Unix Specification version 4 (I.E. SUSv4, I.E. POSIX 2008):

  http://www.opengroup.org/onlinepubs/9699919799/functions/free.html

  > If ptr is a null pointer, no action shall occur.

I.E. free() has a null check built-in, as required by POSIX.

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds


More information about the uClibc mailing list