[asterisk-commits] russell: trunk r82311 - /trunk/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 13 08:34:24 CDT 2007


Author: russell
Date: Thu Sep 13 08:34:24 2007
New Revision: 82311

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82311
Log:
Fix a missing unref of a member struct.  This was pointed out by Marta.  Thanks!
This function in 1.4 didn't have the problem.

Modified:
    trunk/apps/app_queue.c

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=82311&r1=82310&r2=82311
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Thu Sep 13 08:34:24 2007
@@ -514,21 +514,17 @@
 
 	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;
-		}
 
 		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;
-			ao2_ref(member, -1);
 			break;
 		default:
 			if (member->paused) {




More information about the asterisk-commits mailing list