From: Olle Johansson Date: Sun, 29 Oct 2006 17:07:47 +0000 (+0000) Subject: Issues related to issue #7828 - segfault with MWI subscriptions and realtime. X-Git-Tag: 1.6.0-beta1~3^2~4234 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1086f1dfb532acc72a60ebaa1355376af793a3d4;p=thirdparty%2Fasterisk.git 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 --- 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)