Fix potential seg in iax2 from reload when registrations are going
authorMark Spencer <markster@digium.com>
Wed, 28 Apr 2004 22:07:59 +0000 (22:07 +0000)
committerMark Spencer <markster@digium.com>
Wed, 28 Apr 2004 22:07:59 +0000 (22:07 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2807 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index 1c11a03..9cfb628 100755 (executable)
@@ -6076,8 +6076,18 @@ static void delete_users(void)
        for (reg = registrations;reg;) {
                regl = reg;
                reg = reg->next;
-               if (regl->expire > -1)
+               if (regl->expire > -1) {
                        ast_sched_del(sched, regl->expire);
+               }
+               if (regl->callno) {
+                       /* XXX Is this a potential lock?  I don't think so, but you never know */
+                       ast_mutex_lock(&iaxsl[regl->callno]);
+                       if (iaxs[regl->callno]) {
+                               iaxs[regl->callno]->reg = NULL;
+                               iax2_destroy_nolock(regl->callno);
+                       }
+                       ast_mutex_unlock(&iaxsl[regl->callno]);
+               }
                free(regl);
        }
        registrations = NULL;