From 4f97aec64651db5d0e29d66630d09dc5eb0fbea3 Mon Sep 17 00:00:00 2001 From: russell Date: Fri, 6 Jul 2007 23:02:58 +0000 Subject: Merged revisions 73768 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r73768 | russell | 2007-07-06 18:01:22 -0500 (Fri, 06 Jul 2007) | 4 lines If a sip_pvt struct has already registered an extension state callback, remove the old one before adding a new one. If this isn't done, Asterisk will crash. (issue #10120) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@73769 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_sip.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 92b29c9da..a3b127a84 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -14624,8 +14624,11 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, return 0; } - if (p->subscribed != MWI_NOTIFICATION && !resubscribe) + if (p->subscribed != MWI_NOTIFICATION && !resubscribe) { + if (p->stateid > -1) + ast_extension_state_del(p->stateid, cb_extensionstate); p->stateid = ast_extension_state_add(p->context, p->exten, cb_extensionstate, p); + } if (!ast_test_flag(req, SIP_PKT_IGNORE) && p) p->lastinvite = seqno; -- cgit v1.2.3