From 05fed23d06537de73eeda5fa8d61663cc137d6a3 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Tue, 24 Jan 2006 22:32:09 +0000 Subject: [PATCH] ensure that channel cannot become zombie after we check but before we try to start indications git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@8588 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/channel.c b/channel.c index 56d06978d2..ff5390c95b 100644 --- a/channel.c +++ b/channel.c @@ -2005,10 +2005,12 @@ int ast_indicate(struct ast_channel *chan, int condition) { int res = -1; + ast_mutex_lock(&chan->lock); /* Stop if we're a zombie or need a soft hangup */ - if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) + if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) { + ast_mutex_unlock(&chan->lock); return -1; - ast_mutex_lock(&chan->lock); + } if (chan->tech->indicate) res = chan->tech->indicate(chan, condition); ast_mutex_unlock(&chan->lock);