Merged revisions 302785 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Wed, 19 Jan 2011 22:36:30 +0000 (22:36 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 19 Jan 2011 22:36:30 +0000 (22:36 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r302785 | russell | 2011-01-19 16:35:15 -0600 (Wed, 19 Jan 2011) | 15 lines

  Resolve a memory leak with the manager interface is disabled.

  The intent of this check as it stands in previous versions of Asterisk was to
  check if there are any active sessions.  If there were no sessions, then the
  function would return immediately and not bother with queueing up the manager
  event to be processed.  Since the conversion of storing sessions in an astobj2
  container, this check will always pass.  I changed it to go back to checking
  what was intended.

  The side effect of this was that if the AMI is disabled, the manager event
  queue is populated anyway, but the code that runs to clear out the queue
  never runs.  A producer with no consumer is a bad thing.

  Reported internally by kmorgan.
........

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

main/manager.c

index 5edab26..1f87d03 100644 (file)
@@ -4781,7 +4781,7 @@ int __ast_manager_event_multichan(int category, const char *event, int chancount
        struct ast_str *buf;
        int i;
 
-       if (!sessions && AST_RWLIST_EMPTY(&manager_hooks)) {
+       if (!ao2_container_count(sessions) && AST_RWLIST_EMPTY(&manager_hooks)) {
                return 0;
        }