X-Git-Url: http://git.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=ucimap.c;fp=ucimap.c;h=758a5eabda266149e08a52c5f85872156e65b91c;hp=c46cf45a40d7a4f222d8353d42f6e45c706f7bc7;hb=52bbc99f69ea6f67b6fe264f424dac91bde5016c;hpb=3fbd6c923434db61267e1331319b5b125e7838d8 diff --git a/ucimap.c b/ucimap.c index c46cf45..758a5ea 100644 --- a/ucimap.c +++ b/ucimap.c @@ -661,11 +661,10 @@ ucimap_parse_section(struct uci_map *map, struct uci_sectionmap *sm, struct ucim size = sizeof(struct ucimap_list) + n_elements * sizeof(union ucimap_data); - data->list = malloc(size); + data->list = calloc(1, size); if (!data->list) goto error_mem; - memset(data->list, 0, size); data->list->size = n_elements; } else { ucimap_count_alloc(om, &n_alloc, &n_alloc_custom); @@ -897,10 +896,9 @@ ucimap_parse(struct uci_map *map, struct uci_package *pkg) continue; memset(sd, 0, sizeof(struct ucimap_section_data)); } else { - sd = malloc(sm->alloc_len); + sd = calloc(1, sm->alloc_len); if (!sd) continue; - memset(sd, 0, sm->alloc_len); sd = ucimap_ptr_section(sm, sd); }