3 @@ -266,7 +266,7 @@ uci_lua_foreach(lua_State *L)
5 struct uci_context *ctx;
7 - struct uci_element *e;
8 + struct uci_element *e, *tmp;
9 const char *package, *type;
12 @@ -287,7 +287,7 @@ uci_lua_foreach(lua_State *L)
16 - uci_foreach_element(&p->sections, e) {
17 + uci_foreach_element_safe(&p->sections, tmp, e) {
18 struct uci_section *s = uci_to_section(e);