From: Gregory Nietsky Date: Thu, 15 Sep 2011 08:29:12 +0000 (+0000) Subject: Merged revisions 335978 via svnmerge from X-Git-Tag: 10.0.0-beta2~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25de12ee73524e8a638ed26a5d73c2cccdd4bc61;p=thirdparty%2Fasterisk.git Merged revisions 335978 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r335978 | irroot | 2011-09-15 10:15:22 +0200 (Thu, 15 Sep 2011) | 11 lines lock the channel before calling ast_bridged_channel() to prevent a seg fault. AMI agents list called on shutdown causes a segfault, introducing proper locking will prevent this. (closes issue ASTERISK-18092) Reported by: agustina Patches: chan_agent.patch (License #5041) patch uploaded by irroot ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@335991 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 6e17f1be96..13f080ebb2 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -1507,6 +1507,7 @@ static int action_agents(struct mansession *s, const struct message *m) char *talkingto = NULL; char *talkingtoChan = NULL; char *status = NULL; + struct ast_channel *bridge; if (!ast_strlen_zero(id)) snprintf(idText, sizeof(idText) ,"ActionID: %s\r\n", id); @@ -1531,10 +1532,13 @@ static int action_agents(struct mansession *s, const struct message *m) if (p->owner && p->owner->_bridge) { talkingto = S_COR(p->chan->caller.id.number.valid, p->chan->caller.id.number.str, "n/a"); - if (ast_bridged_channel(p->owner)) - talkingtoChan = ast_strdupa(ast_bridged_channel(p->owner)->name); - else + ast_channel_lock(p->owner); + if ((bridge = ast_bridged_channel(p->owner))) { + talkingtoChan = ast_strdupa(bridge->name); + } else { talkingtoChan = "n/a"; + } + ast_channel_unlock(p->owner); status = "AGENT_ONCALL"; } else { talkingto = "n/a";