diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-01-27 18:06:43 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-01-27 18:06:43 +0000 |
commit | 03a33164c0e7f7be19eaa9eea7629a7e4d136b05 (patch) | |
tree | e1d8c6ef32db9ea78f5d522b44b8c7fe433d38ba | |
parent | 8bedd6a9fcc24cd9357f5a8659feff125b28522e (diff) |
Use a safe list traversal while checking for duplicate vars in pbx_builtin_setvar_helper.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@243486 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | main/pbx.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/main/pbx.c b/main/pbx.c index 18210c512..928c7bf90 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -5937,14 +5937,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(headp, entries); ast_var_delete(newvariable); break; } } + AST_LIST_TRAVERSE_SAFE_END; if (value) { if ((option_verbose > 1) && (headp == &globals)) |