diff options
author | Mark Michelson <mmichelson@digium.com> | 2008-02-20 21:41:31 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2008-02-20 21:41:31 +0000 |
commit | b895cda7a38e8c536b534b01b478c476aceda17d (patch) | |
tree | b22f6fb02706dc4a4c79758893223a428a292651 | |
parent | ea8c695a1c3f2f66fb2fb06acf0c0399d51be5d7 (diff) |
Merged revisions 103904 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r103904 | mmichelson | 2008-02-20 15:40:08 -0600 (Wed, 20 Feb 2008) | 6 lines
Fix a crash if the channel becomes NULL while attempting to lock it.
(closes issue #12039)
Reported by: danpwi
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103908 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_local.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c index f03f1331b..c1c597b93 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -511,13 +511,15 @@ static int local_hangup(struct ast_channel *ast) const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS"); if ((status) && (p->owner)) { /* Deadlock avoidance */ - while (ast_channel_trylock(p->owner)) { + while (p->owner && ast_channel_trylock(p->owner)) { ast_mutex_unlock(&p->lock); usleep(1); ast_mutex_lock(&p->lock); } - pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status); - ast_channel_unlock(p->owner); + if (p->owner) { + pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status); + ast_channel_unlock(p->owner); + } } p->chan = NULL; ast_clear_flag(p, LOCAL_LAUNCHED_PBX); |