From: Mark Michelson Date: Wed, 27 Jan 2010 18:08:51 +0000 (+0000) Subject: Merged revisions 243487 via svnmerge from X-Git-Tag: 1.6.0.23~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f8d167899b620c63b6502516ed1ff52d3c1dc12;p=thirdparty%2Fasterisk.git Merged revisions 243487 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r243487 | mmichelson | 2010-01-27 12:08:02 -0600 (Wed, 27 Jan 2010) | 9 lines Merged revisions 243486 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r243486 | mmichelson | 2010-01-27 12:06:43 -0600 (Wed, 27 Jan 2010) | 3 lines Use a safe list traversal while checking for duplicate vars in pbx_builtin_setvar_helper. ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@243488 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/pbx.c b/main/pbx.c index d86d44df3e..eb2aba10ae 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -8157,14 +8157,15 @@ void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const 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(entries); ast_var_delete(newvariable); break; } } + AST_LIST_TRAVERSE_SAFE_END; if (value) { if (headp == &globals)