X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=ucimap.c;h=d4dc05fe3d8781cc5986b6f2df256422049643ac;hb=ceaa2fbb3ce565b8d952179f2ac4cfe9190580ef;hp=455cf36e02a7fd4e3d37551eb45839e6bdb27d98;hpb=3fa4e980d9dd281ad556069e09d17ba64ef4156d;p=uci.git diff --git a/ucimap.c b/ucimap.c index 455cf36..d4dc05f 100644 --- a/ucimap.c +++ b/ucimap.c @@ -282,11 +282,17 @@ ucimap_parse_section(struct uci_map *map, struct uci_sectionmap *sm, struct uci_ int n_alloc = 2; int err; - sd = malloc(sm->alloc_len); + if (sm->alloc) { + sd = sm->alloc(map, sm, s); + memset(sd, 0, sizeof(struct ucimap_section_data)); + } else { + sd = malloc(sm->alloc_len); + memset(sd, 0, sm->alloc_len); + } + if (!sd) return UCI_ERR_MEM; - memset(sd, 0, sm->alloc_len); INIT_LIST_HEAD(&sd->list); sd->map = map; sd->sm = sm;