Merged revisions 174148 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Sat, 7 Feb 2009 16:16:50 +0000 (16:16 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sat, 7 Feb 2009 16:16:50 +0000 (16:16 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r174148 | russell | 2009-02-07 10:15:07 -0600 (Sat, 07 Feb 2009) | 2 lines

Fix a race condition that could cause a crash.

........

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

res/snmp/agent.c

index 6acf536..0a47879 100644 (file)
@@ -569,9 +569,9 @@ static u_char *ast_var_channel_types_table(struct variable *vp, oid *name, size_
        case ASTCHANTYPECHANNELS:
                long_ret = 0;
                for (chan = ast_channel_walk_locked(NULL); chan; chan = ast_channel_walk_locked(chan)) {
-                       ast_channel_unlock(chan);
                        if (chan->tech == tech)
                                long_ret++;
+                       ast_channel_unlock(chan);
                }
                return (u_char *)&long_ret;
        default: