From: Walter Doekes Date: Thu, 2 Jul 2015 14:08:12 +0000 (+0200) Subject: chan_sip: Fix early call pickup channel leak. X-Git-Tag: 14.0.0-beta1~834^2 X-Git-Url: http://git.asterisk.org/gitweb/?p=asterisk%2Fasterisk.git;a=commitdiff_plain;h=34323f9f952f9d103660bfea15ddc8949b915e78 chan_sip: Fix early call pickup channel leak. When handle_invite_replaces() was called, and either ast_bridge_impart() failed or there was no bridge (because the channel we're picking up was still ringing), chan_sip would leak a channel. Thanks Matt and Corey for checking the bridge path. ASTERISK-25226 #close Change-Id: Ie736bb182170a73eef5bcef0ab0376f645c260c8 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 96609d2..412a257 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -24926,10 +24926,12 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, if (ast_bridge_impart(bridge, c, replaces_chan, NULL, AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) { ast_hangup(c); + ast_channel_unref(c); } } else { ast_channel_move(replaces_chan, c); ast_hangup(c); + ast_channel_unref(c); } sip_pvt_lock(p); return 0;