mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 19:08:14 +00:00
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/branches/1.4@103904 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -503,13 +503,15 @@ static int local_hangup(struct ast_channel *ast)
|
|||||||
const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");
|
const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");
|
||||||
if ((status) && (p->owner)) {
|
if ((status) && (p->owner)) {
|
||||||
/* Deadlock avoidance */
|
/* Deadlock avoidance */
|
||||||
while (ast_channel_trylock(p->owner)) {
|
while (p->owner && ast_channel_trylock(p->owner)) {
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
usleep(1);
|
usleep(1);
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
}
|
}
|
||||||
pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
|
if (p->owner) {
|
||||||
ast_channel_unlock(p->owner);
|
pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
|
||||||
|
ast_channel_unlock(p->owner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p->chan = NULL;
|
p->chan = NULL;
|
||||||
ast_clear_flag(p, LOCAL_LAUNCHED_PBX);
|
ast_clear_flag(p, LOCAL_LAUNCHED_PBX);
|
||||||
|
|||||||
Reference in New Issue
Block a user