From 1086f1dfb532acc72a60ebaa1355376af793a3d4 Mon Sep 17 00:00:00 2001 From: Olle Johansson Date: Sun, 29 Oct 2006 17:07:47 +0000 Subject: [PATCH] Issues related to issue #7828 - segfault with MWI subscriptions and realtime. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46400 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index fe257a0593..bd1f0f0639 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1981,6 +1981,10 @@ static int __sip_autodestruct(void *data) return 10000; /* Reschedule this destruction so that we know that it's gone */ } + if (p->subscribed == MWI_NOTIFICATION) + if (p->relatedpeer) + ASTOBJ_UNREF(p->relatedpeer,sip_destroy_peer); /* Remove link to peer. If it's realtime, make sure it's gone from memory) */ + /* Reset schedule ID */ p->autokillid = -1; @@ -1990,11 +1994,10 @@ static int __sip_autodestruct(void *data) if (p->owner) { ast_log(LOG_WARNING, "Autodestruct on dialog '%s' with owner in place (Method: %s)\n", p->callid, sip_methods[p->method].text); ast_queue_hangup(p->owner); - } else if (p->refer) { + } else if (p->refer) transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1); - } else { + else sip_destroy(p); - } return 0; } @@ -2916,7 +2919,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner) ast_verbose("Really destroying SIP dialog '%s' Method: %s\n", p->callid, sip_methods[p->method].text); /* Remove link from peer to subscription of MWI */ - if (p->relatedpeer && p->relatedpeer->mwipvt) + if (p->relatedpeer && p->relatedpeer->mwipvt) p->relatedpeer->mwipvt = NULL; if (dumphistory)