uci: libuci leaking memory on non-existent config file
[project/uci.git] / ucimap.c
index 0bc31c58601dbee9bbbfdc75dde2dc65c70b8fea..776a30439ef2ac9839e3cd5d6f5e25c4bdfb2e99 100644 (file)
--- a/ucimap.c
+++ b/ucimap.c
@@ -314,6 +314,7 @@ ucimap_add_fixup(struct ucimap_section_data *sd, union ucimap_data *data, struct
        struct ucimap_fixup *f, tmp;
        struct uci_map *map = sd->map;
 
        struct ucimap_fixup *f, tmp;
        struct uci_map *map = sd->map;
 
+       tmp.next = NULL;
        tmp.sm = om->data.sm;
        tmp.name = str;
        tmp.type = om->type;
        tmp.sm = om->data.sm;
        tmp.name = str;
        tmp.type = om->type;
@@ -712,6 +713,8 @@ ucimap_parse_section(struct uci_map *map, struct uci_sectionmap *sm, struct ucim
        return 0;
 
 error_mem:
        return 0;
 
 error_mem:
+       if (sd->alloc_custom)
+               free(sd->alloc_custom);
        if (sd->allocmap)
                free(sd->allocmap);
        free(sd);
        if (sd->allocmap)
                free(sd->allocmap);
        free(sd);