aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_local.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-20 21:41:31 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-20 21:41:31 +0000
commit9139e10c779926da51e60712bae87597801baaba (patch)
treeb22f6fb02706dc4a4c79758893223a428a292651 /channels/chan_local.c
parent4d5a77ea87e19e0291d0662a42f03e1ccbe93369 (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: http://svn.digium.com/svn/asterisk/trunk@103908 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r--channels/chan_local.c8
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);