]> git.ipfire.org Git - thirdparty/asterisk.git/commit
chan_sip.c: Fix INVITE with replaces channel ref leak.
authorRichard Mudgett <rmudgett@digium.com>
Thu, 5 Apr 2018 22:40:52 +0000 (17:40 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 5 Apr 2018 23:34:32 +0000 (17:34 -0600)
commit8dd7ba31e96e39bb39c902063f8cab71236908b2
tree29857037da36c107a9ed7059a8c5570b3b71e08c
parent3719880d4955330a15d868b1452d827aff013b1a
chan_sip.c: Fix INVITE with replaces channel ref leak.

Given the below call scenario:
A -> Ast1 -> B
C <- Ast2 <- B

1) A calls B through Ast1
2) B calls C through Ast2
3) B transfers A to C

When party B transfers A to C, B sends a REFER to Ast1 causing Ast1 to
send an INVITE with replaces to Ast2.  Ast2 then leaks a channel ref of
the channel between Ast1 and Ast2.

Channel ref leaks are easily seen in the CLI "core show channels" output.
The leaked channels appear in the output but you can do nothing with them
and they never go away unless you restart Asterisk.

* Properly account for the channel refs when imparting a channel into a
bridge when handling an INVITE with replaces in handle_invite_replaces().
The ast_bridge_impart() function steals a channel ref but the code didn't
account for how many refs were held by the code at the time and which ref
was stolen.

* Eliminated RAII_VAR in handle_invite_replaces().

ASTERISK-27740

Change-Id: I7edbed774314b55acf0067b2762bfe984ecaa9a4
channels/chan_sip.c