fix ucimap_set_changed
[project/uci.git] / ucimap.c
index c347b24..cb86a4f 100644 (file)
--- a/ucimap.c
+++ b/ucimap.c
@@ -388,13 +388,14 @@ ucimap_set_changed(void *section, void *field)
        struct uci_sectmap *sm = sd->sm;
        struct uci_optmap *om;
        int ofs = (char *)field - (char *)section;
-       int i;
+       int i = 0;
 
        ucimap_foreach_option(sm, om) {
                if (om->offset == ofs) {
                        SET_BIT(sd->cmap, i);
                        break;
                }
+               i++;
        }
 }
 
@@ -509,6 +510,7 @@ ucimap_parse(struct uci_map *map, struct uci_package *pkg)
                        list->item[list->n_items++].section = ptr;
                        break;
                }
+               free(f);
        }
        list_for_each_safe(p, tmp, &map->sdata) {
                struct uci_sectmap_data *sd = list_entry(p, struct uci_sectmap_data, list);