Check registry carefully before unlinking
authorMark Spencer <markster@digium.com>
Wed, 1 Oct 2003 04:53:53 +0000 (04:53 +0000)
committerMark Spencer <markster@digium.com>
Wed, 1 Oct 2003 04:53:53 +0000 (04:53 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1592 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 0ac22f9..03df2dd 100755 (executable)
@@ -889,7 +889,14 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner)
                p->route = NULL;
        }
        if (p->registry) {
-               p->registry->call=NULL;
+               /* Carefully unlink from registry */
+               struct sip_registry *reg;
+               reg = registrations;
+               while(reg) {
+                       if ((reg == p->registry) && (p->registry->call == p))
+                               p->registry->call=NULL;
+                       reg = reg->next;
+               }
        }
        /* Unlink us from the owner if we have one */
        if (p->owner) {