From 5c258942ee6d3c0fba14168e3568ba25eb9addc0 Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Thu, 10 Dec 2015 12:19:19 +0000 Subject: [PATCH] example/ip_pipeline: fix config file parsing defect Coverity issue: 120143 Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax") Signed-off-by: Fan Zhang Acked-by: Cristian Dumitrescu --- examples/ip_pipeline/config_parse.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c index 6aaca115e9..67e58c9b08 100644 --- a/examples/ip_pipeline/config_parse.c +++ b/examples/ip_pipeline/config_parse.c @@ -1930,7 +1930,11 @@ app_config_parse(struct app_params *app, const char *file_name) APP_CHECK(cfg != NULL, "Unable to load config file %s", file_name); sect_count = rte_cfgfile_num_sections(cfg, NULL, 0); + APP_CHECK(sect_count > 0, "Number of sections return %d", sect_count); + section_names = malloc(sect_count * sizeof(char *)); + APP_CHECK(section_names != NULL, "Failed to allocate memory"); + for (i = 0; i < sect_count; i++) section_names[i] = malloc(CFG_NAME_LEN); -- 2.20.1