Index: main/pbx.c =================================================================== --- main/pbx.c (revision 85850) +++ main/pbx.c (working copy) @@ -5822,7 +5822,7 @@ if (headp == &globals) ast_mutex_lock(&globalslock); - 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); @@ -5830,6 +5830,7 @@ break; } } + AST_LIST_TRAVERSE_SAFE_END; if (value) { if ((option_verbose > 1) && (headp == &globals))