[asterisk-dev] [Code Review] 2617: Prevent crash during synchronous AMI origination by ref bumping returned channel
Matt Jordan
reviewboard at asterisk.org
Wed Jun 12 11:45:30 CDT 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2617/
-----------------------------------------------------------
Review request for Asterisk Developers and Joshua Colp.
Repository: Asterisk
Description
-------
*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.
Diffs
-----
/trunk/main/pbx.c 391524
/trunk/main/manager.c 391524
/trunk/include/asterisk/pbx.h 391524
Diff: https://reviewboard.asterisk.org/r/2617/diff/
Testing
-------
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.
Thanks,
Matt Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130612/bad7bf30/attachment.htm>
More information about the asterisk-dev
mailing list