[asterisk-dev] [svn-commits] mmichelson: branch 1.4 r202601 - /branches/1.4/channels/chan_sip.c

Olle E. Johansson oej at edvina.net
Wed Jun 24 03:14:46 CDT 2009


23 jun 2009 kl. 20.09 skrev Mark Michelson:

> Olle E. Johansson wrote:
>> 23 jun 2009 kl. 17.22 skrev SVN commits to the Digium repositories:
>>
>>> Author: mmichelson
>>> Date: Tue Jun 23 10:22:35 2009
>>> New Revision: 202601
>>>
>>> URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=202601
>>> Log:
>>> Fix more memory leaks that may result if rtp is not successfully
>>> allocated.
>>
>>
>> It certainly doesn't harm to close these, but I don't think they are
>> leaks, since we should clean it up in the destruction of the dialog
>> all the time. If we're not doing that, then that's a bug in itself.
>>
>> /O
>>
>
> You are partially correct. In trunk, 1.6.1, and 1.6.2, this cleanup  
> is taken
> care of because the sip_pvt is an ao2 object. When the rtp  
> allocation failures
> happen, we unref the sip_pvt and know that the __sip_destroy  
> function will take
> care of all the potential leaks.
>
> In 1.4 and 1.6.0, however, you'll notice that the action taken was  
> to just free
> the sip_pvt (and a couple of allocated fields). The problem was that  
> several
> allocations made earlier in the sip_alloc function were not being  
> freed. It may
> be that a valid alternative to freeing all the necessary memory  
> would be just to
> call __sip_destroy on the sip_pvt. What do you think?
A lot of code just assumes that _sip_destroy will be called all the  
time to do the generic cleaning up, so not doing that is a bad idea.  
Adding it is a good idea! Thanks for finding that bug!

Greetings from Asterisk training in sunny Malaga, Spain.

/O



More information about the asterisk-dev mailing list