Fix a minor logic flaw with the bridge generic thread.
authorJoshua Colp <jcolp@digium.com>
Sun, 22 Mar 2009 21:00:28 +0000 (21:00 +0000)
committerJoshua Colp <jcolp@digium.com>
Sun, 22 Mar 2009 21:00:28 +0000 (21:00 +0000)
We only want to move the channel pointers that are actually present.

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

main/bridging.c

index 4546c83..4306680 100644 (file)
@@ -319,7 +319,7 @@ static int generic_thread_loop(struct ast_bridge *bridge)
                /* Move channels around for priority reasons if we have more than one channel in our array */
                if (bridge->array_num > 1) {
                        struct ast_channel *first = bridge->array[0];
-                       memmove(bridge->array, bridge->array + 1, sizeof(bridge->array) - 1);
+                       memmove(bridge->array, bridge->array + 1, sizeof(struct ast_channel *) * (bridge->array_num - 1));
                        bridge->array[(bridge->array_num - 1)] = first;
                }