summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2009-04-20 17:05:15 +0000
committerJoshua Colp <jcolp@digium.com>2009-04-20 17:05:15 +0000
commitb5b18b781025872e066b5244951365e657b7d41c (patch)
treeffcb7df5e36f6cfb577324ea504b2ccc2159bba0 /channels
parent4988c07e6d41c5b571cd6fa5d31a587530b0487f (diff)
Fix a bug with non-UDP connections that caused dialogs to not get freed.
This issue crept up because of a reference count issue on non-UDP based dialogs. The dialog reference count was increased when transmitting a packet reliably but never decreased. This caused the dialog structure to hang around despite being unlinked from the dialogs container. (closes issue #14919) Reported by: vrban git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 39b90a901..c556d91ce 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3598,7 +3598,7 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int res
/* I removed the code from retrans_pkt that does the same thing so it doesn't get loaded into the scheduler */
/*! \todo According to the RFC some packets need to be retransmitted even if its TCP, so this needs to get revisited */
if (!(p->socket.type & SIP_TRANSPORT_UDP)) {
- xmitres = __sip_xmit(dialog_ref(p, "passing dialog ptr into callback..."), data, len); /* Send packet */
+ xmitres = __sip_xmit(p, data, len); /* Send packet */
if (xmitres == XMIT_ERROR) { /* Serious network trouble, no need to try again */
append_history(p, "XmitErr", "%s", fatal ? "(Critical)" : "(Non-critical)");
return AST_FAILURE;
@@ -3641,6 +3641,7 @@ static enum sip_result __sip_reliable_xmit(struct sip_pvt *p, int seqno, int res
ast_log(LOG_ERROR, "Serious Network Trouble; __sip_xmit returns error for pkt data\n");
AST_SCHED_DEL(sched, pkt->retransid);
p->packets = pkt->next;
+ pkt->owner = dialog_unref(pkt->owner,"pkt is being freed, its dialog ref is dead now");
ast_free(pkt->data);
ast_free(pkt);
return AST_FAILURE;