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

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


Author: mmichelson
Date: Tue Nov 12 13:08:14 2013
New Revision: 402768

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402768
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.
........

Merged revisions 402767 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:08:14 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402738,402755,402757
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402738,402755,402757,402767

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