Fix a missing unref of a member struct. This was pointed out by Marta. Thanks!
authorRussell Bryant <russell@russellbryant.com>
Thu, 13 Sep 2007 13:34:24 +0000 (13:34 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 13 Sep 2007 13:34:24 +0000 (13:34 +0000)
This function in 1.4 didn't have the problem.

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

apps/app_queue.c

index adf7525..0f3f824 100644 (file)
@@ -514,21 +514,17 @@ static enum queue_member_status get_member_status(struct call_queue *q, int max_
 
        ast_mutex_lock(&q->lock);
        mem_iter = ao2_iterator_init(q->members, 0);
 
        ast_mutex_lock(&q->lock);
        mem_iter = ao2_iterator_init(q->members, 0);
-       while ((member = ao2_iterator_next(&mem_iter))) {
-               if (max_penalty && (member->penalty > max_penalty)) {
-                       ao2_ref(member, -1);
+       for (; (member = ao2_iterator_next(&mem_iter)); ao2_ref(member, -1)) {
+               if (max_penalty && (member->penalty > max_penalty))
                        continue;
                        continue;
-               }
 
                switch (member->status) {
                case AST_DEVICE_INVALID:
                        /* nothing to do */
 
                switch (member->status) {
                case AST_DEVICE_INVALID:
                        /* nothing to do */
-                       ao2_ref(member, -1);
                        break;
                case AST_DEVICE_UNAVAILABLE:
                        if (result != QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS) 
                                result = QUEUE_NO_REACHABLE_MEMBERS;
                        break;
                case AST_DEVICE_UNAVAILABLE:
                        if (result != QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS) 
                                result = QUEUE_NO_REACHABLE_MEMBERS;
-                       ao2_ref(member, -1);
                        break;
                default:
                        if (member->paused) {
                        break;
                default:
                        if (member->paused) {