From 5001983a5632b8b8dc4524fcfae95e103ef3a0bb Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 19 Jan 2011 22:35:15 +0000 Subject: [PATCH] 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/branches/1.8@302785 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/manager.c b/main/manager.c index b52cbd0589..592565d79a 100644 --- a/main/manager.c +++ b/main/manager.c @@ -4787,7 +4787,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; }