[svn-commits] mmichelson: branch 12 r402769 - /branches/12/main/channel.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Nov 12 13:11:30 CST 2013


Author: mmichelson
Date: Tue Nov 12 13:11:28 2013
New Revision: 402769

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


Modified:
    branches/12/main/channel.c

Modified: branches/12/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/channel.c?view=diff&rev=402769&r1=402768&r2=402769
==============================================================================
--- branches/12/main/channel.c (original)
+++ branches/12/main/channel.c Tue Nov 12 13:11:28 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 svn-commits mailing list