From 314877e155213741a5d728306fcc34c7642c7380 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Wed, 28 Apr 2004 22:07:59 +0000 Subject: [PATCH] Fix potential seg in iax2 from reload when registrations are going git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2807 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_iax2.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 1c11a0385a..9cfb628f54 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -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;