summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-06-26 01:46:30 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-06-26 01:46:30 +0000
commita022379107a6c55d5c8ce393d1f5da6691ccac3c (patch)
treed5ecd8e834e4963f863415113fc0df56f9c0e228 /channels
parentf25bbd6c56e55c4dca7239f0c56eb4b6bee1b155 (diff)
Fix incorrect calls to ast_bridge_impart().
There was a misunderstanding about ast_bridge_impart()'s handling of the imparted channel's reference. The channel reference is passed by the caller unless ast_bridge_impart() returns an error. * Fixed a memory leak in conf_announce_channel_push() if the impart failed. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392934 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 689b43a05..916fd5ebe 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -24777,8 +24777,8 @@ static int handle_request_options(struct sip_pvt *p, struct sip_request *req, st
static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req,
int *nounlock, struct sip_pvt *replaces_pvt, struct ast_channel *replaces_chan)
{
+ struct ast_channel *c;
RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
- RAII_VAR(struct ast_channel *, c, NULL, ao2_cleanup);
if (req->ignore) {
return 0;
@@ -24813,7 +24813,9 @@ static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req,
ast_channel_unlock(replaces_chan);
if (bridge) {
- ast_bridge_impart(bridge, c, replaces_chan, NULL, 1);
+ if (ast_bridge_impart(bridge, c, replaces_chan, NULL, 1)) {
+ ast_hangup(c);
+ }
} else {
ast_channel_move(replaces_chan, c);
ast_hangup(c);