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 6DDD2A053D; Fri, 17 Jul 2020 12:51:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E74D51C0B1; Fri, 17 Jul 2020 12:50:39 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 680341C022; Fri, 17 Jul 2020 12:50:37 +0200 (CEST) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 485A0EE7AD7BF95B2D95; Fri, 17 Jul 2020 18:50:34 +0800 (CST) Received: from localhost (10.174.185.168) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Fri, 17 Jul 2020 18:50:26 +0800 From: wangyunjian To: , CC: , , Yunjian Wang , Date: Fri, 17 Jul 2020 18:50:17 +0800 Message-ID: <1594983017-21936-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.185.168] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2] bus/fslmc: fix memory leak in secondary process 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" From: Yunjian Wang In fslmc_process_mcp(), we allocate memory for 'dev_name' but not released before return in secondary process. And it is not used since commit a69f79300262 ("bus/fslmc: support multi VFIO group"), so it can be removed. Fixes: e55d0494ab98 ("bus/fslmc: support secondary process") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- v2: * Remove unused dev_name suggested by David Marchand --- drivers/bus/fslmc/fslmc_vfio.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index efe2c43d3..9134ec552 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -739,7 +739,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev) { int ret; intptr_t v_addr; - char *dev_name = NULL; struct fsl_mc_io dpmng = {0}; struct mc_version mc_ver_info = {0}; @@ -750,13 +749,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev) goto cleanup; } - dev_name = strdup(dev->device.name); - if (!dev_name) { - DPAA2_BUS_ERR("Unable to allocate MC device name memory"); - ret = -ENOMEM; - goto cleanup; - } - v_addr = vfio_map_mcp_obj(dev->device.name); if (v_addr == (intptr_t)MAP_FAILED) { DPAA2_BUS_ERR("Error mapping region (errno = %d)", errno); @@ -793,13 +785,9 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev) } rte_mcp_ptr_list[MC_PORTAL_INDEX] = (void *)v_addr; - free(dev_name); return 0; cleanup: - if (dev_name) - free(dev_name); - if (rte_mcp_ptr_list) { free(rte_mcp_ptr_list); rte_mcp_ptr_list = NULL; -- 2.23.0