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

Kevin Day thekevinday at gmail.com
Fri Nov 27 17:45:50 UTC 2009


On Fri, Nov 27, 2009 at 7:10 AM, Natanael Copa <natanael.copa at gmail.com> wrote:
> On Fri, 2009-11-27 at 12:31 +0000, Natanael Copa wrote:
>> This fixes an issue when a CNAME was returned for an A query.
>> Garbage was returned.
>>
>> Postfix was affected of this.
>
> FWIW, this patch is also a candidate for 0_9_30 tree.
>
> -nc
>

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?

Looking at the top portion of both your patch (again at the untouched
code portion of the patch) and 0.9.28.3 code, they are both calling
free(a.dotted); without checking it as well.
Is there a reason for not doing this?
I am imagining segfaults here if the memory does not get allocated.

If you are talking about saving space by not using the "if (pointer)
free(pointer)" practice, isn't this optimized away by gcc's
delete-null-pointer-checks flag for the cases where it IS safe to
remove?


-- 
Kevin Day


More information about the uClibc mailing list