[asterisk-commits] rmudgett: branch 12 r408715 - /branches/12/main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Feb 21 12:17:16 CST 2014


Author: rmudgett
Date: Fri Feb 21 12:17:14 2014
New Revision: 408715

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=408715
Log:
manager: Fix AMI Status action of a single channel.

Fixed use of uninitialized ao2 container iterator in an off-nominal
condition.  Either a memory allocation error or the requested channel is
an internal channel not exposed to the outside.

Modified:
    branches/12/main/manager.c

Modified: branches/12/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/manager.c?view=diff&rev=408715&r1=408714&r2=408715
==============================================================================
--- branches/12/main/manager.c (original)
+++ branches/12/main/manager.c Fri Feb 21 12:17:14 2014
@@ -3878,7 +3878,7 @@
 	}
 
 	/* if we look by name, we break after the first iteration */
-	for (; msg; ao2_ref(msg, -1), msg = ao2_iterator_next(&it_chans)) {
+	for (; msg; ao2_ref(msg, -1), msg = all ? ao2_iterator_next(&it_chans) : NULL) {
 		struct ast_channel_snapshot *snapshot = stasis_message_data(msg);
 		struct ast_channel *c;
 		struct ast_str *built = ast_manager_build_channel_state_string_prefix(snapshot, "");
@@ -3961,11 +3961,6 @@
 			idText);
 
 		ast_free(built);
-
-		if (!all) {
-			ao2_ref(msg, -1);
-			break;
-		}
 	}
 
 	if (all) {




More information about the asterisk-commits mailing list