diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-02 21:36:39 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-07-02 21:36:39 +0000 |
commit | e08cb0ffa6dbd44c975ad5186f326ba2ee94b718 (patch) | |
tree | 1ff96db0aa1cf867ac85b9adfc65844e982bbde7 /channels/chan_local.c | |
parent | 4015a6816f3f78a0f4ef60529029d4a7dcbb1c9a (diff) |
Have the DEADLOCK_AVOIDANCE macro warn when an unlock fails, to help catch potentially large software bugs.
(closes issue #17407)
Reported by: pdf
Patches:
20100527__issue17407.diff.txt uploaded by tilghman (license 14)
Review: https://reviewboard.asterisk.org/r/751/
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@273793 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r-- | channels/chan_local.c | 12 |
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)); |