[asterisk-commits] mmichelson: branch 1.4 r243486 - /branches/1.4/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 27 12:06:47 CST 2010


Author: mmichelson
Date: Wed Jan 27 12:06:43 2010
New Revision: 243486

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=243486
Log:
Use a safe list traversal while checking for duplicate vars in pbx_builtin_setvar_helper.


Modified:
    branches/1.4/main/pbx.c

Modified: branches/1.4/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/pbx.c?view=diff&rev=243486&r1=243485&r2=243486
==============================================================================
--- branches/1.4/main/pbx.c (original)
+++ branches/1.4/main/pbx.c Wed Jan 27 12:06:43 2010
@@ -5937,14 +5937,15 @@
 			nametail++;
 	}
 
-	AST_LIST_TRAVERSE (headp, newvariable, entries) {
+	AST_LIST_TRAVERSE_SAFE_BEGIN(headp, newvariable, entries) {
 		if (strcasecmp(ast_var_name(newvariable), nametail) == 0) {
 			/* there is already such a variable, delete it */
-			AST_LIST_REMOVE(headp, newvariable, entries);
+			AST_LIST_REMOVE_CURRENT(headp, entries);
 			ast_var_delete(newvariable);
 			break;
 		}
 	}
+	AST_LIST_TRAVERSE_SAFE_END;
 
 	if (value) {
 		if ((option_verbose > 1) && (headp == &globals))




More information about the asterisk-commits mailing list