[svn-commits] mmichelson: branch mmichelson/rls-notify r420055 - /team/mmichelson/rls-notif...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 5 13:26:51 CDT 2014


Author: mmichelson
Date: Tue Aug  5 13:26:49 2014
New Revision: 420055

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=420055
Log:
Address review board feedback.


Modified:
    team/mmichelson/rls-notify/res/res_pjsip_exten_state.c
    team/mmichelson/rls-notify/res/res_pjsip_pubsub.c

Modified: team/mmichelson/rls-notify/res/res_pjsip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/rls-notify/res/res_pjsip_exten_state.c?view=diff&rev=420055&r1=420054&r2=420055
==============================================================================
--- team/mmichelson/rls-notify/res/res_pjsip_exten_state.c (original)
+++ team/mmichelson/rls-notify/res/res_pjsip_exten_state.c Tue Aug  5 13:26:49 2014
@@ -229,6 +229,9 @@
 	/* Pool allocation has to happen here so that we allocate within a PJLIB thread */
 	task_data->exten_state_data.pool = pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(),
 			"exten_state", 1024, 1024);
+	if (!task_data->exten_state_data.pool) {
+		return -1;
+	}
 
 	task_data->exten_state_data.sub = task_data->exten_state_sub->sip_sub;
 
@@ -425,6 +428,10 @@
 
 	exten_state_data->pool = pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(),
 			"exten_state", 1024, 1024);
+	if (!exten_state_data->pool) {
+		ao2_cleanup(exten_state_data);
+		return NULL;
+	}
 
 	exten_state_data->device_state_info = info;
 	return exten_state_data;

Modified: team/mmichelson/rls-notify/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/rls-notify/res/res_pjsip_pubsub.c?view=diff&rev=420055&r1=420054&r2=420055
==============================================================================
--- team/mmichelson/rls-notify/res/res_pjsip_pubsub.c (original)
+++ team/mmichelson/rls-notify/res/res_pjsip_pubsub.c Tue Aug  5 13:26:49 2014
@@ -677,7 +677,10 @@
 	}
 
 	strcpy(node->resource, resource);
-	AST_VECTOR_INIT(&node->children, 4);
+	if (AST_VECTOR_INIT(&node->children, 4)) {
+		ast_free(node);
+		return NULL;
+	}
 
 	if (visited) {
 		AST_VECTOR_APPEND(visited, resource);
@@ -868,13 +871,22 @@
 	if (!list) {
 		ast_debug(1, "Subscription to resource %s is not to a list\n", resource);
 		tree->root = tree_node_alloc(resource, NULL);
+		if (!tree->root) {
+			return 500;
+		}
 		return handler->notifier->new_subscribe(endpoint, resource);
 	}
 
 	ast_debug(1, "Subscription to resource %s is a list\n", resource);
-	AST_VECTOR_INIT(&visited, AST_VECTOR_SIZE(&list->items));
+	if (AST_VECTOR_INIT(&visited, AST_VECTOR_SIZE(&list->items))) {
+		return 500;
+	}
 
 	tree->root = tree_node_alloc(resource, &visited);
+	if (!tree->root) {
+		return 500;
+	}
+
 	tree->notification_batch_interval = list->notification_batch_interval;
 
 	build_node_children(endpoint, handler, list, tree->root, &visited);
@@ -995,12 +1007,10 @@
  * \brief Create a tree of virtual subscriptions based on a resource tree node.
  *
  * \param handler The handler to supply to leaf subscriptions.
- * \param endpoint The endpoint that sent the SUBSCRIBE request to Asterisk.
- * \param rdata The SUBSCRIBE request content.
- * \param resource The requested resource in the SUBSCRIBE request.
+ * \param resource The requested resource for this subscription.
  * \param generator Body generator to use for leaf subscriptions.
- * \param parent The subscription (real or virtual) that is parent to the subscriptions created here.
- * \param parent_resource The tree node that corresponds to the parent subscription.
+ * \param tree The root of the subscription tree.
+ * \param current The tree node that corresponds to the subscription being created.
  */
 static struct ast_sip_subscription *create_virtual_subscriptions(const struct ast_sip_subscription_handler *handler,
 		const char *resource, struct ast_sip_pubsub_body_generator *generator,
@@ -1024,6 +1034,8 @@
 				tree, child_node);
 
 		if (!child) {
+			ast_debug(1, "Child subscription to resource %s could not be created\n",
+					child_node->resource);
 			continue;
 		}
 
@@ -1230,6 +1242,7 @@
 	} else {
 		ast_sorcery_delete(ast_sip_get_sorcery(), persistence);
 	}
+	resource_tree_destroy(&tree);
 
 	return 0;
 }




More information about the svn-commits mailing list