]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
manager: Fix AMI Status action of a single channel.
authorRichard Mudgett <rmudgett@digium.com>
Fri, 21 Feb 2014 18:17:14 +0000 (18:17 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 21 Feb 2014 18:17:14 +0000 (18:17 +0000)
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.

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

main/manager.c

index 950f6e8ff194e3bbf8ba83a2ebab422b91479c09..83d57f8fb2da8ba0e70d1bcffe0d2f263ca97b51 100644 (file)
@@ -3878,7 +3878,7 @@ static int action_status(struct mansession *s, const struct message *m)
        }
 
        /* 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 @@ static int action_status(struct mansession *s, const struct message *m)
                        idText);
 
                ast_free(built);
-
-               if (!all) {
-                       ao2_ref(msg, -1);
-                       break;
-               }
        }
 
        if (all) {