[asterisk-dev] [Code Review] 4389: Memory leak cleanups

Mark Michelson reviewboard at asterisk.org
Thu Jan 29 13:24:00 CST 2015


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

(Updated Jan. 29, 2015, 7:24 p.m.)


Review request for Asterisk Developers.


Changes
-------

John added one more change.

In res_pjsip_refer, some ordering was modified to avoid reading from a refer_progress_notification after it had been freed. This was because the queued task could sometimes run and complete before the check of the notification state.


Bugs: ASTERISK-24736
    https://issues.asterisk.org/jira/browse/ASTERISK-24736


Repository: Asterisk


Description
-------

John Hardin of Digium did some investigation into memory leaks he was seeing and created a set of patches that fixes them. I've already given these patches a look and have made a few small adjustments to them where necessary for coding guidelines reasons. Most of the leak fixes are pretty straightforward, but one of these bears a bit of explanation:

Prior to Asterisk 12, originating calls with channel variables required that you transfer ownership of the created ast_variables structure away when calling ast_pbx_outgoing_exten() or ast_pbx_outgoing_app(). This was presumably because these functions could spawn threads that required these variables to not be freed yet. However, in Asterisk 12, ast_pbx_outgoing_exten() and ast_pbx_outgoing_app() were rewritten to not use the variables in the spawned threads. However, we also stopped actually destroying the variables there, too. So with this patch, responsibility for freeing the variables lies with the original creator of the variables.


Diffs (updated)
-----

  /branches/13/res/res_pjsip_refer.c 431302 
  /branches/13/pbx/pbx_spool.c 431302 
  /branches/13/main/xmldoc.c 431302 
  /branches/13/main/stasis_channels.c 431302 
  /branches/13/main/pbx.c 431302 
  /branches/13/main/manager.c 431302 
  /branches/13/main/bridge_after.c 431302 
  /branches/13/channels/chan_pjsip.c 431302 

Diff: https://reviewboard.asterisk.org/r/4389/diff/


Testing
-------

John Hardin's testing with valgrind has shown that the memory leaks it had been reported are no longer present.


Thanks,

Mark Michelson

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150129/90e52d85/attachment.html>


More information about the asterisk-dev mailing list