From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D7CB6A04C0; Tue, 6 Oct 2020 22:39:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 421C31B5E1; Tue, 6 Oct 2020 22:38:09 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id E5AF12C28 for ; Tue, 6 Oct 2020 22:38:02 +0200 (CEST) IronPort-SDR: 3X2iW1MQ6GY0ePWWpdaQBVEJx+w1nA5mvZ05ale0V0+X8n5gmtfY7+z61PuVUni5K9xqATbbfE qeAdpfyO/73A== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="151607415" X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="151607415" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Oct 2020 13:38:02 -0700 IronPort-SDR: /D3cNOiDd2WysEA8ZoKSt1kp3eE9GIwJcdWms8jy3a62eH4CoE5imIfgPMhuUseyp3Mfyznz4G CE6iD5qzFi0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="460985815" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by orsmga004.jf.intel.com with ESMTP; 06 Oct 2020 13:38:02 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 6 Oct 2020 21:37:55 +0100 Message-Id: <20201006203755.90779-7-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201006203755.90779-1-cristian.dumitrescu@intel.com> References: <20201006203755.90779-1-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH 7/7] pipeline: fix instruction config free X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fixes: a1711f948d ("pipeline: add SWX Rx and extract instructions") Coverity issue: 362901 Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_swx_pipeline.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c index a4d072d6d..d5b4a1cc6 100644 --- a/lib/librte_pipeline/rte_swx_pipeline.c +++ b/lib/librte_pipeline/rte_swx_pipeline.c @@ -5932,7 +5932,6 @@ instruction_config(struct rte_swx_pipeline *p, { struct instruction *instr = NULL; struct instruction_data *data = NULL; - char *string = NULL; int err = 0; uint32_t i; @@ -5955,15 +5954,17 @@ instruction_config(struct rte_swx_pipeline *p, } for (i = 0; i < n_instructions; i++) { - string = strdup(instructions[i]); + char *string = strdup(instructions[i]); if (!string) { err = ENOMEM; goto error; } err = instr_translate(p, a, string, &instr[i], &data[i]); - if (err) + if (err) { + free(string); goto error; + } free(string); } @@ -5982,8 +5983,6 @@ instruction_config(struct rte_swx_pipeline *p, if (err) goto error; - free(data); - if (a) { a->instructions = instr; a->n_instructions = n_instructions; @@ -5992,10 +5991,10 @@ instruction_config(struct rte_swx_pipeline *p, p->n_instructions = n_instructions; } + free(data); return 0; error: - free(string); free(data); free(instr); return err; -- 2.17.1