From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B6C6A2C6E; Tue, 22 May 2018 12:25:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2018 03:25:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,429,1520924400"; d="scan'208";a="230749082" Received: from dpdkx8602.sh.intel.com ([10.67.110.200]) by fmsmga006.fm.intel.com with ESMTP; 22 May 2018 03:25:40 -0700 From: Rosen Xu To: dev@dpdk.org, thomas@monjalon.net Cc: rosen.xu@intel.com, roy.fan.zhang@intel.com, declan.doherty@intel.com, bruce.richardson@intel.com, shreyansh.jain@nxp.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, tianfei.zhang@intel.com, song.liu@intel.com, hao.wu@intel.com, gaetan.rivet@6wind.com, stable@dpdk.org Date: Tue, 22 May 2018 18:26:17 +0800 Message-Id: <1526984778-95506-3-git-send-email-rosen.xu@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1526984778-95506-1-git-send-email-rosen.xu@intel.com> References: <1526478506-153943-1-git-send-email-rosen.xu@intel.com> <1526984778-95506-1-git-send-email-rosen.xu@intel.com> Subject: [dpdk-stable] [PATCH v2 2/3] bus/ifpga: fix resource leaks issue X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 10:25:43 -0000 There are some resource leaks in ifpga_scan_one. This patch fixes it. Coverity issue: 279459 Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") Cc: stable@dpdk.org Signed-off-by: Rosen Xu --- drivers/bus/ifpga/ifpga_bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index 675b9a3..db16173 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -156,27 +156,29 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) if (rawdev->dev_ops && rawdev->dev_ops->dev_start && rawdev->dev_ops->dev_start(rawdev)) - goto free_dev; + goto end; strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path)); if (rawdev->dev_ops->firmware_load && rawdev->dev_ops->firmware_load(rawdev, &afu_pr_conf)){ IFPGA_BUS_ERR("firmware load error %d\n", ret); - goto free_dev; + goto end; } afu_dev->id.uuid.uuid_low = afu_pr_conf.afu_id.uuid.uuid_low; afu_dev->id.uuid.uuid_high = afu_pr_conf.afu_id.uuid.uuid_high; + rte_kvargs_free(kvlist); + free(path); return afu_dev; -free_dev: - free(afu_dev); end: if (kvlist) rte_kvargs_free(kvlist); if (path) free(path); + if (afu_dev) + free(afu_dev); return NULL; } -- 1.8.3.1