[asterisk-commits] eliel: branch group/data_api_gsoc2009 r206379 - /team/group/data_api_gsoc2009...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 14 08:04:00 CDT 2009


Author: eliel
Date: Tue Jul 14 08:03:56 2009
New Revision: 206379

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206379
Log:
Unref the member and not the queue on error.
Formatting change.


Modified:
    team/group/data_api_gsoc2009/apps/app_queue.c

Modified: team/group/data_api_gsoc2009/apps/app_queue.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/apps/app_queue.c?view=diff&rev=206379&r1=206378&r2=206379
==============================================================================
--- team/group/data_api_gsoc2009/apps/app_queue.c (original)
+++ team/group/data_api_gsoc2009/apps/app_queue.c Tue Jul 14 08:03:56 2009
@@ -7483,7 +7483,8 @@
 	struct ao2_iterator i, im;
 	struct call_queue *queue;
 	struct member *member;
-	struct ast_data *data_root, *data_queue = NULL, *data_member, *data_members = NULL;
+	struct ast_data *data_root, *data_queue = NULL, *data_member;
+	struct ast_data *data_members = NULL;
 	int member_added;
 
 	data_root = ast_data_create("queues");
@@ -7496,7 +7497,8 @@
 		ao2_lock(queue);
 
 		/* compare the search pattern. */
-		if (ast_data_search_cmp_structure(search, call_queue, queue, "queues/queue")) {
+		if (ast_data_search_cmp_structure(search, call_queue, queue,
+			"queues/queue")) {
 			/* this doesn't match! continue! */
 			ao2_unlock(queue);
 			queue_unref(queue);
@@ -7509,25 +7511,26 @@
 			im = ao2_iterator_init(queue->members, 0);
 			while ((member = ao2_iterator_next(&im))) {
 				/* compare the member structure. */
-				if (ast_data_search_cmp_structure(search, member, member, "queues/queue/members/member")) {
+				if (ast_data_search_cmp_structure(search, member, member,
+					"queues/queue/members/member")) {
 					ao2_ref(member, -1);
 					continue;
 				}
 
 				if (!data_queue) {
-					data_queue = ast_data_add_node(data_root, "queue");
+					data_queue = ast_data_add_node(data_root,
+						"queue");
 					if (!data_queue) {
-						ao2_unlock(queue);
-						queue_unref(queue);
+						ao2_ref(member, -1);
 						continue;
 					}
 				}
 
 				if (!data_members) {
-					data_members = ast_data_add_node(data_queue, "members");
+					data_members = ast_data_add_node(data_queue,
+						"members");
 					if (!data_members) {
-						ao2_unlock(queue);
-						queue_unref(queue);
+						ao2_ref(member, -1);
 						continue;
 					}
 				}
@@ -7543,6 +7546,8 @@
 				ao2_ref(member, -1);
 			}
 		}
+		/* if there was a member added to the tree, then added the following
+		 * queue to the tree. */
 		if (member_added) {
 			ast_data_add_structure(call_queue, data_queue, queue);
 		}




More information about the asterisk-commits mailing list