[asterisk-dev] [Code Review] 2617: Prevent crash during synchronous AMI origination by ref bumping returned channel

svnbot reviewboard at asterisk.org
Mon Jul 1 16:24:25 CDT 2013

This is an automatically generated e-mail. To reply, visit:

(Updated July 1, 2013, 4:24 p.m.)


This change has been marked as submitted.

Review request for Asterisk Developers and Joshua Colp.


Committed in revision 393361

Repository: Asterisk


*NOTE*: this only happens on trunk.

The originate APIs allow callers to provide a pointer to a channel that will point to the originated channel if the function call succeeds. This is used by AMI to provide channel information when the originate is performed synchronously. Unfortunately, if the originate fails in certain ways, the outbound channel is already disposed of during the dialing itself. This results in the channel being improperly dereferenced by the internal originate function in pbx.c.

This patch ref bumps the channel to prevent this from occurring. Callers must now unlock and unref the channel (which is more in line with general channel management guidelines anyway).

This only affects manager, as it is the only consumer of this API function that actually passes in a channel pointer.


  /trunk/main/pbx.c 391524 
  /trunk/main/manager.c 391524 
  /trunk/include/asterisk/pbx.h 391524 

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


One of the Dial tests in the Asterisk Test Suite caught this. With this change, it stopped crashing and reported the failure of the originate correctly.


Matt Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130701/e4364700/attachment.htm>

More information about the asterisk-dev mailing list