aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r--channels/chan_local.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index e705ee582..81f16eadf 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -183,10 +183,18 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra
/* Ensure that we have both channels locked */
while (other && ast_channel_trylock(other)) {
- ast_mutex_unlock(&p->lock);
+ int res;
+ if ((res = ast_mutex_unlock(&p->lock))) {
+ ast_log(LOG_ERROR, "chan_local bug! '&p->lock' was not locked when entering local_queue_frame! (%s)\n", strerror(res));
+ return -1;
+ }
if (us && us_locked) {
do {
- ast_channel_unlock(us);
+ if (ast_channel_unlock(us)) {
+ ast_log(LOG_ERROR, "chan_local bug! Our channel was not locked, yet arguments indicated that it was!!\n");
+ ast_mutex_lock(&p->lock);
+ return -1;
+ }
usleep(1);
ast_channel_lock(us);
} while (ast_mutex_trylock(&p->lock));