aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r--channels/chan_agent.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index ddfb74ae2..e0081ee30 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -733,7 +733,12 @@ static int agent_indicate(struct ast_channel *ast, int condition, const void *da
ast_mutex_lock(&p->lock);
if (p->chan && !ast_check_hangup(p->chan)) {
while (ast_channel_trylock(p->chan)) {
- ast_channel_unlock(ast);
+ int res;
+ if ((res = ast_channel_unlock(ast))) {
+ ast_log(LOG_ERROR, "chan_agent bug! Channel was not locked upon entry to agent_indicate: %s\n", strerror(res));
+ ast_mutex_unlock(&p->lock);
+ return -1;
+ }
usleep(1);
ast_channel_lock(ast);
}