[asterisk-commits] russell: branch 1.8 r302785 - /branches/1.8/main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 19 16:35:20 CST 2011


Author: russell
Date: Wed Jan 19 16:35:15 2011
New Revision: 302785

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=302785
Log:
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.

Modified:
    branches/1.8/main/manager.c

Modified: branches/1.8/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/manager.c?view=diff&rev=302785&r1=302784&r2=302785
==============================================================================
--- branches/1.8/main/manager.c (original)
+++ branches/1.8/main/manager.c Wed Jan 19 16:35:15 2011
@@ -4787,7 +4787,7 @@
 	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;
 	}
 	




More information about the asterisk-commits mailing list