From patchwork Tue Oct 6 20:37:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 79830 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BDFA0A04C0; Tue, 6 Oct 2020 22:38:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 91EA52B82; Tue, 6 Oct 2020 22:38:01 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 6F85E2952 for ; Tue, 6 Oct 2020 22:37:59 +0200 (CEST) IronPort-SDR: +QxTn9dvf9b8Ibg2xaZShHQvd8Iu8njNf/HlVyHp4EZAyfq/t9c8Z+uP5tDx9EpNYaUPM4jV7I eQ8KcZGI6qfg== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="151607352" X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="151607352" 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:37:57 -0700 IronPort-SDR: Enc5iriZKxLCcdjcgDMNLqqJGCsRMA5lZoqr6HGShKlXd8zgRRGj/FZ5YpDs/u0zvkU78FUkDs l/nK5iVlcUEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="460985784" 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:37:56 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 6 Oct 2020 21:37:49 +0100 Message-Id: <20201006203755.90779-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH 1/7] pipeline: fix memory leak issue 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: b32c0a2c5e ("pipeline: add SWX table update high level API") Coverity issue: 362741 Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_swx_ctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_pipeline/rte_swx_ctl.c b/lib/librte_pipeline/rte_swx_ctl.c index 576fb2bf3..9d986a83e 100644 --- a/lib/librte_pipeline/rte_swx_ctl.c +++ b/lib/librte_pipeline/rte_swx_ctl.c @@ -1463,6 +1463,7 @@ rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl, arg_offset += arg->n_bits / 8; } + free(s0); return entry; error: From patchwork Tue Oct 6 20:37:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 79831 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B876A04C0; Tue, 6 Oct 2020 22:38:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 42B032C28; Tue, 6 Oct 2020 22:38:04 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 04EEF2952 for ; Tue, 6 Oct 2020 22:37:59 +0200 (CEST) IronPort-SDR: yP/zudVOo9Kh65GsQBQbmgDfW2n8MBqj1Bl7YWP6cPRIRV7M2ARdpC9k+wBqF4HgMtav064YLF STqkueG44jHg== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="151607365" X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="151607365" 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:37:58 -0700 IronPort-SDR: iZPFQsP+83JtMnnLkRJl7NjOeYJAgWsb2sHXxR/L466BcFcvMPr34sKNSGxQ+qKFqK6sNAh1LU g0aDw6BbbVyg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="460985787" 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:37:57 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 6 Oct 2020 21:37:50 +0100 Message-Id: <20201006203755.90779-2-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 2/7] examples/pipeline: fix files for table update 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: 5074e1d551 ("examples/pipeline: add configuration commands") Coverity issues: 362744, 362745, 362882 Signed-off-by: Cristian Dumitrescu --- examples/pipeline/cli.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 9f3d87a3c..76a58ee28 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -836,8 +836,8 @@ cmd_pipeline_table_update(char **tokens, } if (strcmp(file_name_delete, "none")) { - file_add = fopen(file_name_delete, "r"); - if (!file_add) { + file_delete = fopen(file_name_delete, "r"); + if (!file_delete) { snprintf(out, out_size, "Cannot open file %s", file_name_delete); goto error; @@ -845,8 +845,8 @@ cmd_pipeline_table_update(char **tokens, } if (strcmp(file_name_default, "none")) { - file_add = fopen(file_name_default, "r"); - if (!file_add) { + file_default = fopen(file_name_default, "r"); + if (!file_default) { snprintf(out, out_size, "Cannot open file %s", file_name_default); goto error; From patchwork Tue Oct 6 20:37:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 79832 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5E76DA04C0; Tue, 6 Oct 2020 22:38:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C30A94C8E; Tue, 6 Oct 2020 22:38:05 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 7D4AB2952 for ; Tue, 6 Oct 2020 22:38:01 +0200 (CEST) IronPort-SDR: 0r755wLwh6S1LxiV5ok+wcgFgKFK97Slbvd0Q3nMPSV+8sibH+KdLzKZWQnYiE+90IlB8cQaVY cQXQyov3yevQ== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="151607380" X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="151607380" 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:37:59 -0700 IronPort-SDR: ++bgZte51SZUiitIqyMmHMi16Pghn9KkwsOGAtPggqDZuJ8PQ4tqB3cUSmklMKv5IAI55Vtce+ C0dAAAtegyAw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="460985792" 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:37:58 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 6 Oct 2020 21:37:51 +0100 Message-Id: <20201006203755.90779-3-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 3/7] pipeline: fix argument check 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: 3ca60ceed7 ("pipeline: add SWX pipeline specification file") Coverity issue: 362789 Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_swx_pipeline_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pipeline/rte_swx_pipeline_spec.c b/lib/librte_pipeline/rte_swx_pipeline_spec.c index 95de8f983..06e1ab438 100644 --- a/lib/librte_pipeline/rte_swx_pipeline_spec.c +++ b/lib/librte_pipeline/rte_swx_pipeline_spec.c @@ -1064,7 +1064,7 @@ rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p, goto error; } - if (!p) { + if (!spec) { if (err_line) *err_line = 0; if (err_msg) From patchwork Tue Oct 6 20:37:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 79833 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 208DAA04C0; Tue, 6 Oct 2020 22:38:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 087031B28D; Tue, 6 Oct 2020 22:38:07 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id E6EA52C16 for ; Tue, 6 Oct 2020 22:38:01 +0200 (CEST) IronPort-SDR: ccGuCAtxnbYgv3MGehA8QzCnS4r5ksIUbp2qhgc/jRM4ZAx8mTJx0EnouS/U8XpY9xdwoMWoux O5LITLDm3kbQ== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="151607393" X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="151607393" 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:00 -0700 IronPort-SDR: ngR4bvdyLU49o6bEd5DOPfvbLyBfX69+U7E6+TAQ8uyrfGh8fH47Va0+Mv05pbY22xftlAIkNE pOicv2ksi3HQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="460985800" 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:37:59 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 6 Oct 2020 21:37:52 +0100 Message-Id: <20201006203755.90779-4-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 4/7] pipeline: fix memory free issues 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: 3ca60ceed7 ("pipeline: add SWX pipeline specification file") Coverity issues: 362796, 362804, 362819, 362836, 362858, 362865, 362869 Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_swx_pipeline_spec.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/librte_pipeline/rte_swx_pipeline_spec.c b/lib/librte_pipeline/rte_swx_pipeline_spec.c index 06e1ab438..a4bc8226a 100644 --- a/lib/librte_pipeline/rte_swx_pipeline_spec.c +++ b/lib/librte_pipeline/rte_swx_pipeline_spec.c @@ -35,9 +35,17 @@ struct extobj_spec { static void extobj_spec_free(struct extobj_spec *s) { + if (!s) + return; + free(s->name); + s->name = NULL; + free(s->extern_type_name); + s->extern_type_name = NULL; + free(s->pragma); + s->pragma = NULL; } static int @@ -246,8 +254,14 @@ struct header_spec { static void header_spec_free(struct header_spec *s) { + if (!s) + return; + free(s->name); + s->name = NULL; + free(s->struct_type_name); + s->struct_type_name = NULL; } static int @@ -297,7 +311,11 @@ struct metadata_spec { static void metadata_spec_free(struct metadata_spec *s) { + if (!s) + return; + free(s->struct_type_name); + s->struct_type_name = NULL; } static int From patchwork Tue Oct 6 20:37:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 79836 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6DB6A04C0; Tue, 6 Oct 2020 22:39:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 58EF61B664; Tue, 6 Oct 2020 22:38:10 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 516992C54 for ; Tue, 6 Oct 2020 22:38:02 +0200 (CEST) IronPort-SDR: kJehWwWbmkCejfMSqcHk6j6ln3DrBOjYTIV+W9MWEC6gB53eMcwDtK1M05Uym93cZdzqXJHq7s 4L2ro+0USiUA== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="151607406" X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="151607406" 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:01 -0700 IronPort-SDR: MmLBLd9DF6ev45QDfdpqKJmC8+mUiKgvd6JKKG6nQzHie8K8/w8R5hxwK9Ya4KHkxuOZNwJndi dPwAGYVvNLgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="460985805" 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:00 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 6 Oct 2020 21:37:53 +0100 Message-Id: <20201006203755.90779-5-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 5/7] pipeline: fix resource leak issue 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: b32c0a2c5e ("pipeline: add SWX table update high level API") Coverity issue: 362812 Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_swx_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pipeline/rte_swx_ctl.c b/lib/librte_pipeline/rte_swx_ctl.c index 9d986a83e..ee6df4544 100644 --- a/lib/librte_pipeline/rte_swx_ctl.c +++ b/lib/librte_pipeline/rte_swx_ctl.c @@ -371,7 +371,7 @@ table_entry_duplicate(struct rte_swx_ctl_pipeline *ctl, } } - return entry; + return new_entry; error: table_entry_free(new_entry); From patchwork Tue Oct 6 20:37:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 79834 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C3585A04C0; Tue, 6 Oct 2020 22:39:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 322EF1B3C8; Tue, 6 Oct 2020 22:38:08 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 7BEFA2C16 for ; Tue, 6 Oct 2020 22:38:02 +0200 (CEST) IronPort-SDR: siJeHpSKVSollWs9V8OioZm2gshSjMzSsnNWuraw1Fq6bOilXefdazkZR43Qk/ld2YdAZdrubD rKolKvPeZGCg== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="151607414" X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="151607414" 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:01 -0700 IronPort-SDR: cvCzX7EqKGJYL33vcdk9EXtyNnSaF8eVbk17gl2mMM40UjcuJ1G0RKyMeL8JrjHuBOWYYOhdQR vXZ9Agd5vbog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,343,1596524400"; d="scan'208";a="460985811" 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:01 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 6 Oct 2020 21:37:54 +0100 Message-Id: <20201006203755.90779-6-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 6/7] pipeline: fix unused variable issue 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: 75634474ca ("pipeline: add SWX instruction verifier") Coverity issue: 362855 Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_swx_pipeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c index 8b7ff56f6..a4d072d6d 100644 --- a/lib/librte_pipeline/rte_swx_pipeline.c +++ b/lib/librte_pipeline/rte_swx_pipeline.c @@ -5671,7 +5671,7 @@ instr_verify(struct rte_swx_pipeline *p __rte_unused, for (i = 0; i < n_instructions; i++) { type = instr[i].type; - if (instr[i].type == INSTR_TX) + if (type == INSTR_TX) break; } CHECK(i < n_instructions, EINVAL); From patchwork Tue Oct 6 20:37:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 79835 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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;