[asterisk-dev] [Code Review] automagically set a pointer to null after it is freed with ast_free

Kevin P. Fleming kpfleming at digium.com
Mon Sep 19 08:10:16 CDT 2011


On 09/19/2011 03:23 AM, schmidts wrote:
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1441/
>
>
> Review request for Asterisk Developers and David Vossel.
> By schmidts.
>
> /Updated Sept. 19, 2011, 3:23 a.m./
>
>
>   Changes
>
> i have changed the parts rmudgett said. thanks for this it works fine.
>
> then i have tried to add a warning to astmm.c if a null pointer is freed and i see a lot of this warning coming for example from manager at startup and also channel.c on an incoming sip call. all this things looks like freeing an allready destroyed structure but i didnt get to deep into it to say if this happens cause of lazy style or if its really necessary.

You are drawing a conclusion that isn't warranted; there are many places 
in Asterisk that already called ast_free() on NULL pointers *before* 
your patch, so your warning about calling ast_free() with a NULL pointer 
does *not* indicate a 'double-free' situation.

To watch for those, as someone else posted on this thread, you'd need to 
replace the pointer with a 'magic' value, and then check for that magic 
value in ast_free().

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kfleming at digium.com | SIP: kpfleming at digium.com | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list