X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_cfgfile%2Frte_cfgfile.c;h=9049fd9c2319113fc2107ec933530e0f63120aea;hb=30f9f9f451531e41a1c51fe93ca965adb5a12e27;hp=3884151479305adc94e83283acae91602b689670;hpb=0cfffed310c30fcd9dcc837349677f4d2976270e;p=dpdk.git diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index 3884151479..9049fd9c23 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -281,17 +281,16 @@ rte_cfgfile_create(int flags) cfg->num_sections = 0; /* allocate first batch of sections and entries */ - cfg->sections = malloc(sizeof(struct rte_cfgfile_section) * - CFG_ALLOC_SECTION_BATCH); - + cfg->sections = calloc(CFG_ALLOC_SECTION_BATCH, + sizeof(struct rte_cfgfile_section)); if (cfg->sections == NULL) goto error1; cfg->allocated_sections = CFG_ALLOC_SECTION_BATCH; for (i = 0; i < CFG_ALLOC_SECTION_BATCH; i++) { - cfg->sections[i].entries = malloc(sizeof( - struct rte_cfgfile_entry) * CFG_ALLOC_ENTRY_BATCH); + cfg->sections[i].entries = calloc(CFG_ALLOC_ENTRY_BATCH, + sizeof(struct rte_cfgfile_entry)); if (cfg->sections[i].entries == NULL) goto error1;