[asterisk-commits] mmichelson: trunk r402778 - in /trunk: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 12 13:38:05 CST 2013


Author: mmichelson
Date: Tue Nov 12 13:38:03 2013
New Revision: 402778

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402778
Log:
Switch to a scoped lock to avoid missing unlocks in failure returns.
........

Merged revisions 402769 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Tue Nov 12 13:38:03 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402738,402755,402757,402767
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402738,402755,402757,402767,402769

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=402778&r1=402777&r2=402778
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Tue Nov 12 13:38:03 2013
@@ -7595,8 +7595,7 @@
 	RAII_VAR(struct varshead *, ret, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_str *, tmp, NULL, ast_free);
 	struct manager_channel_variable *mcv;
-
-	AST_RWLIST_RDLOCK(&channelvars);
+	SCOPED_LOCK(lock, &channelvars, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK);
 
 	if (AST_LIST_EMPTY(&channelvars)) {
 		return NULL;
@@ -7626,13 +7625,11 @@
 
 		var = ast_var_assign(mcv->name, val ? val : "");
 		if (!var) {
-			AST_RWLIST_UNLOCK(&channelvars);
 			return NULL;
 		}
 
 		AST_RWLIST_INSERT_TAIL(ret, var, entries);
 	}
-	AST_RWLIST_UNLOCK(&channelvars);
 
 	ao2_ref(ret, +1);
 	return ret;




More information about the asterisk-commits mailing list