]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
If a sip_pvt struct has already registered an extension state callback,
authorRussell Bryant <russell@russellbryant.com>
Fri, 6 Jul 2007 23:01:22 +0000 (23:01 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 6 Jul 2007 23:01:22 +0000 (23:01 +0000)
remove the old one before adding a new one.  If this isn't done, Asterisk
will crash.  (issue #10120)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@73768 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index e01fbf9e37d647da0e19b06f25025bd291acb583..eb8e55baa2b74b3dc2376444e6a0269044ad782a 100644 (file)
@@ -11191,8 +11191,11 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
                                ast_set_flag(p, SIP_NEEDDESTROY);       
                                return 0;
                        }
-                       if (p->subscribed != NONE)
+                       if (p->subscribed != NONE) {
+                               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);
+                       }
                }
        }