[asterisk-dev] [Code Review] ast_netsock_list memory leak

Russell Bryant russell at digium.com
Thu Oct 8 14:35:04 CDT 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/395/#review1158
-----------------------------------------------------------

Ship it!


- Russell


On 2009-10-08 14:27:39, David Vossel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/395/
> -----------------------------------------------------------
> 
> (Updated 2009-10-08 14:27:39)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> An ast_netsock_list is created by calling ast_netsock_list_alloc, which allocates the memory and returns the pointer.  When the list is destroyed calling ast_netsock_release() all the items in the list are removed and freed, but the list itself isn't freed.  This is a super simple patch, all I did was add an ast_free on the list when ast_netsock_release is called.
> 
> The weird thing about this is that there's an ast_netsock_free in the netsock.h file thats not even implemented.  Is there any reason someone would want to destroy a list but not free it?  I couldn't think of any so I just removed the prototype from the header file.  The netsock functions are only used by chan_iax.c, and according to that implementation the expected behavior for ast_netsock_release is to free the list.  Hints the memory leak.
> 
> 
> Diffs
> -----
> 
>   /trunk/include/asterisk/netsock.h 222872 
>   /trunk/main/netsock.c 222872 
> 
> Diff: https://reviewboard.asterisk.org/r/395/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> David
> 
>




More information about the asterisk-dev mailing list