From patchwork Thu Dec 10 12:19:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Zhang X-Patchwork-Id: 9460 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id BB05F8E66; Thu, 10 Dec 2015 13:19:23 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 07B6A8E5A for ; Thu, 10 Dec 2015 13:19:21 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 10 Dec 2015 04:19:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,407,1444719600"; d="scan'208";a="615807201" Received: from sie-lab-212-033.ir.intel.com (HELO silpixa00383881.ir.intel.com) ([10.237.212.33]) by FMSMGA003.fm.intel.com with ESMTP; 10 Dec 2015 04:19:20 -0800 From: Fan Zhang To: dev@dpdk.org Date: Thu, 10 Dec 2015 12:19:19 +0000 Message-Id: <1449749959-5063-1-git-send-email-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.5.0 Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix config file parse defect X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 6aaca11..c7d5efc 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);