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);
if (sm->alloc) {
sd = sm->alloc(map, sm, s);
+ if (!sd)
+ continue;
memset(sd, 0, sizeof(struct ucimap_section_data));
} else {
- sd = malloc(sm->alloc_len);
- memset(sd, 0, sm->alloc_len);
+ sd = calloc(1, sm->alloc_len);
+ if (!sd)
+ continue;
sd = ucimap_ptr_section(sm, sd);
}
- if (!sd)
- continue;
ucimap_parse_section(map, sm, sd, s);
}