From c6421a8e880b4e82ae64e3bcc377f1f7682429cf Mon Sep 17 00:00:00 2001 From: markster Date: Sat, 24 Jul 2004 23:53:02 +0000 Subject: Sometimes we get subunalloced, gotta free lock first git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3507 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_zap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'channels/chan_zap.c') diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 0920be36b..2510763a8 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -2869,7 +2869,8 @@ static int attempt_transfer(struct zt_pvt *p) p->subs[SUB_REAL].owner->bridge->name, p->subs[SUB_THREEWAY].owner->name); return -1; } - /* Orphan the channel */ + /* Orphan the channel after releasing the lock */ + ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock); unalloc_sub(p, SUB_THREEWAY); } else if (p->subs[SUB_THREEWAY].owner->bridge) { if (p->subs[SUB_REAL].owner->_state == AST_STATE_RINGING) { @@ -2882,6 +2883,7 @@ static int attempt_transfer(struct zt_pvt *p) return -1; } swap_subs(p, SUB_THREEWAY, SUB_REAL); + ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock); unalloc_sub(p, SUB_THREEWAY); /* Tell the caller not to hangup */ return 1; @@ -3213,7 +3215,8 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast) } } else p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV; - ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock); + if (p->subs[SUB_THREEWAY].owner) + ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock); } else { ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock); /* Swap subs and dis-own channel */ -- cgit v1.2.3