Merged revisions 270980 via svnmerge from
authorJason Parker <jparker@digium.com>
Wed, 16 Jun 2010 21:10:48 +0000 (21:10 +0000)
committerJason Parker <jparker@digium.com>
Wed, 16 Jun 2010 21:10:48 +0000 (21:10 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r270980 | qwell | 2010-06-16 16:10:09 -0500 (Wed, 16 Jun 2010) | 4 lines

  Need to lock the agent chan before access its internal bits.

  Pointed out by russellb on asterisk-dev mailing list.
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270981 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_agent.c

index 02c1753..0b15903 100644 (file)
@@ -2289,7 +2289,9 @@ static int function_agent(struct ast_channel *chan, const char *cmd, char *data,
                ast_copy_string(buf, agent->moh, len);
        else if (!strcasecmp(args.item, "channel")) {
                if (agent->chan) {
+                       ast_channel_lock(agent->chan);
                        ast_copy_string(buf, agent->chan->name, len);
+                       ast_channel_unlock(agent->chan);
                        tmp = strrchr(buf, '-');
                        if (tmp)
                                *tmp = '\0';