130-lua_fix_nested_foreach_delete.patch 485 B

1234567891011121314151617181920
  1. --- a/lua/uci.c
  2. +++ b/lua/uci.c
  3. @@ -266,7 +266,7 @@ uci_lua_foreach(lua_State *L)
  4. {
  5. struct uci_context *ctx;
  6. struct uci_package *p;
  7. - struct uci_element *e;
  8. + struct uci_element *e, *tmp;
  9. const char *package, *type;
  10. bool ret = false;
  11. int offset = 0;
  12. @@ -287,7 +287,7 @@ uci_lua_foreach(lua_State *L)
  13. if (!p)
  14. goto done;
  15. - uci_foreach_element(&p->sections, e) {
  16. + uci_foreach_element_safe(&p->sections, tmp, e) {
  17. struct uci_section *s = uci_to_section(e);
  18. i++;