mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 14:56:58 +00:00
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
This commit is contained in:
@@ -511,14 +511,16 @@ 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);
|
||||||
}
|
}
|
||||||
|
if (p->owner) {
|
||||||
pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
|
pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
|
||||||
ast_channel_unlock(p->owner);
|
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);
|
||||||
ast_module_user_remove(p->u_chan);
|
ast_module_user_remove(p->u_chan);
|
||||||
|
Reference in New Issue
Block a user