aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-07 22:41:48 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-07 22:41:48 +0000
commit61b207fc7bb8e3be2430d8b96ccfc6941ac97265 (patch)
tree5caab8aa60b02042750e9b5eebb84cc18b6f3201 /channels
parent68c863a07fd50fe1431843373cae388dc90a552a (diff)
Fix handling of when a pvt disappears. Properly return the pvt locked
and don't hold the pvt lock while destroying the ast_channel. (closes issue #13014) Reported by: jpgrayson Patches: chan_iax2_ast_iax2_new2.patch uploaded by jpgrayson (license 492) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@128795 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index e54822235..70c8d6072 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -3766,11 +3766,13 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
ast_mutex_unlock(&iaxsl[callno]);
tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "IAX2/%s-%d", i->host, i->callno);
ast_mutex_lock(&iaxsl[callno]);
- if (!iaxs[callno]) {
+ if (i != iaxs[callno]) {
if (tmp) {
+ /* unlock and relock iaxsl[callno] to preserve locking order */
+ ast_mutex_unlock(&iaxsl[callno]);
ast_channel_free(tmp);
+ ast_mutex_lock(&iaxsl[callno]);
}
- ast_mutex_unlock(&iaxsl[callno]);
return NULL;
}