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

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


Author: mmichelson
Date: Tue Nov 12 13:05:44 2013
New Revision: 402767

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402767
Log:
Move a NULL check to a place that makes more sense.

Two variables were being checked for NULLity immediately
after being declared NULL. I moved the NULL check until
after the variables are allocated.

This allows for the "channelvars" option in manager.conf
to work as intended again.


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=402767&r1=402766&r2=402767
==============================================================================
--- branches/12/main/channel.c (original)
+++ branches/12/main/channel.c Tue Nov 12 13:05:44 2013
@@ -7596,18 +7596,18 @@
 	RAII_VAR(struct ast_str *, tmp, NULL, ast_free);
 	struct manager_channel_variable *mcv;
 
+	AST_RWLIST_RDLOCK(&channelvars);
+
+	if (AST_LIST_EMPTY(&channelvars)) {
+		return NULL;
+	}
+
+	ret = ao2_alloc(sizeof(*ret), varshead_dtor);
+	tmp = ast_str_create(16);
+
 	if (!ret || !tmp) {
 		return NULL;
 	}
-
-	AST_RWLIST_RDLOCK(&channelvars);
-
-	if (AST_LIST_EMPTY(&channelvars)) {
-		return NULL;
-	}
-
-	ret = ao2_alloc(sizeof(*ret), varshead_dtor);
-	tmp = ast_str_create(16);
 
 	AST_LIST_TRAVERSE(&channelvars, mcv, entry) {
 		const char *val = NULL;




More information about the svn-commits mailing list