[svn-commits] kharwell: branch kharwell/pimp_sip_state r391900 - /team/kharwell/pimp_sip_st...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 14 16:36:56 CDT 2013


Author: kharwell
Date: Fri Jun 14 16:36:55 2013
New Revision: 391900

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391900
Log:
review updates

Modified:
    team/kharwell/pimp_sip_state/res/res_sip_exten_state.c

Modified: team/kharwell/pimp_sip_state/res/res_sip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/res/res_sip_exten_state.c?view=diff&rev=391900&r1=391899&r2=391900
==============================================================================
--- team/kharwell/pimp_sip_state/res/res_sip_exten_state.c (original)
+++ team/kharwell/pimp_sip_state/res/res_sip_exten_state.c Fri Jun 14 16:36:55 2013
@@ -129,11 +129,11 @@
 		pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_ACCEPT, NULL);
 
 	exten_state_sub->body_types_count = hdr->count;
-	exten_state_sub->body_types = ast_malloc(hdr->count * sizeof(char*));
+	exten_state_sub->body_types = ast_malloc(hdr->count * sizeof(char));
 
 	for (i = 0; i < hdr->count; ++i) {
 		exten_state_sub->body_types[i] =
-			ast_malloc(hdr->values[i].slen * sizeof(char*) + 1);
+			ast_malloc(hdr->values[i].slen * sizeof(char) + 1);
 
 		ast_copy_string(exten_state_sub->body_types[i],
 				pj_strbuf(&hdr->values[i]), hdr->values[i].slen + 1);
@@ -149,7 +149,7 @@
 
 /*!
  * \internal
- * \brief Allocates a exten_state_subscription object.
+ * \brief Allocates an exten_state_subscription object.
  *
  * Creates the underlying SIP subscription for the given request. First makes
  * sure that there are registered handler and provider objects available.
@@ -550,8 +550,6 @@
 
 int ast_sip_register_exten_state_provider(struct ast_sip_exten_state_provider *obj)
 {
-	SCOPED_LOCK(lock, &providers, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
-
 	if (ast_strlen_zero(obj->type)) {
 		ast_log(LOG_WARNING, "Type not specified on provider for event %s\n",
 			obj->event_name);
@@ -576,8 +574,12 @@
 		return -1;
 	}
 
-	AST_RWLIST_INSERT_TAIL(&providers, obj, next);
-	ast_module_ref(ast_module_info->self);
+	/* scope to avoid mix declarations */
+	{
+		SCOPED_LOCK(lock, &providers, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
+		AST_RWLIST_INSERT_TAIL(&providers, obj, next);
+		ast_module_ref(ast_module_info->self);
+	}
 
 	return 0;
 }




More information about the svn-commits mailing list