diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-20 21:40:08 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-20 21:40:08 +0000 |
commit | 15b3bc9a2b12b8b64d73c629f6f4479632cfa57a (patch) | |
tree | 00ccce2e479857543b38196fe416c636f249f63b /channels/chan_local.c | |
parent | 2a584b28fef6b09af2069c815ea6f93e37de8540 (diff) |
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/branches/1.4@103904 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-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 9ea0018b2..5a8d6f002 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -503,13 +503,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); |