[asterisk-commits] irroot: branch 1.8 r335978 - /branches/1.8/channels/chan_agent.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 15 03:15:24 CDT 2011
Author: irroot
Date: Thu Sep 15 03:15:22 2011
New Revision: 335978
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=335978
Log:
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
Modified:
branches/1.8/channels/chan_agent.c
Modified: branches/1.8/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_agent.c?view=diff&rev=335978&r1=335977&r2=335978
==============================================================================
--- branches/1.8/channels/chan_agent.c (original)
+++ branches/1.8/channels/chan_agent.c Thu Sep 15 03:15:22 2011
@@ -1506,6 +1506,7 @@
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);
@@ -1530,10 +1531,13 @@
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";
More information about the asterisk-commits
mailing list