fix a channel deadlock in ast_answer
authorRussell Bryant <russell@russellbryant.com>
Tue, 6 Jun 2006 05:27:14 +0000 (05:27 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 6 Jun 2006 05:27:14 +0000 (05:27 +0000)
(deadlock reported by and debuged with hads on #asterisk-dev on IRC)
(probably fixes issue #7267, maybe others)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@32478 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channel.c

index e8f309e..214a79c 100644 (file)
--- a/channel.c
+++ b/channel.c
@@ -1502,8 +1502,10 @@ int ast_answer(struct ast_channel *chan)
        int res = 0;
        ast_channel_lock(chan);
        /* You can't answer an outbound call */
-       if (ast_test_flag(chan, AST_FLAG_OUTGOING))
+       if (ast_test_flag(chan, AST_FLAG_OUTGOING)) {
+               ast_channel_unlock(chan);
                return 0;
+       }
        /* Stop if we're a zombie or need a soft hangup */
        if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
                ast_channel_unlock(chan);