diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-07-15 18:46:40 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-07-15 18:46:40 +0000 |
commit | 5ac03d340f6457ecdab6a077d85f0edff7b23b83 (patch) | |
tree | 9d569121b7149739c55a69b51503aab5887d1aa9 | |
parent | 49715c05f12d590f5bfd25aa9336c306c4269adf (diff) |
Fix a couple of places in res_agi where the agi_commands lock would not be
released, causing a deadlock. (Reported by mvanbaak in #asterisk-dev,
discovered by bbryant's change to the lock tracking code to yell at you
if a thread exits with a lock still held)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@131072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | res/res_agi.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/res/res_agi.c b/res/res_agi.c index b509ef67d..0f59855f5 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -2434,8 +2434,10 @@ static agi_command *find_command(char *cmds[], int exact) if (!e->cmda[y] && !exact) break; /* don't segfault if the next part of a command doesn't exist */ - if (!e->cmda[y]) + if (!e->cmda[y]) { + AST_RWLIST_UNLOCK(&agi_commands); return NULL; + } if (strcasecmp(e->cmda[y], cmds[y])) match = 0; } @@ -2443,8 +2445,10 @@ static agi_command *find_command(char *cmds[], int exact) a candidate (unless we're looking for a really inexact answer */ if ((exact > -1) && e->cmda[y]) match = 0; - if (match) + if (match) { + AST_RWLIST_UNLOCK(&agi_commands); return e; + } } AST_RWLIST_UNLOCK(&agi_commands); return NULL; |