diff --git a/channel.c b/channel.c index de737f75fa0a708e3b8fdb08aa195a18e94f7161..19f2a81facd16444f2429f8dfb27f20707561188 100644 --- a/channel.c +++ b/channel.c @@ -2050,10 +2050,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);