On Sat, Nov 28, 2009 at 1:06 AM, Kevin Day <[email protected]> wrote:
> On Fri, Nov 27, 2009 at 2:45 PM, Rob Landley <[email protected]> wrote:
>> 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
>>
>
> So you are saying a double-free cannot happen here?
>
> --
> Kevin Day
>
Never mind, I just remember that I have habits and practices that I
have engraved into myself such that I forget the internal details
sometimes.

I generally have a free(..) wrapper that frees the pointer and then
sets the pointer to null so that the double free doesn't happen. And
then out of what I would call paranoia practice I always wrap them in
if (pointer) anyway.

So my concern was if those pointers were freed already and if they
were being set to NULL after they were being freed to prevent double
frees.

Sorry for the double post, it just popped into my mind after I hit the
send button.


-- 
Kevin Day
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to