From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id CACA9A0096 for ; Tue, 9 Apr 2019 21:24:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E46D65689; Tue, 9 Apr 2019 21:24:48 +0200 (CEST) Received: from m12-12.163.com (m12-12.163.com [220.181.12.12]) by dpdk.org (Postfix) with ESMTP id BE7AF4F90 for ; Tue, 9 Apr 2019 16:33:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=ulpe4FDRxwxDSBrypD I6m8Kyh9v7YQ2Y4gDJxGuybKc=; b=F/Uh0E12qYmSVz5ZhTRPrL1RnbAsZx8qIm WHIp2SGLNQK/hfhDsz60pi5CyZILHU3ewGKLqzRTzQv24xVVOhsFNjP/xUjUYYLQ RFmY3nRYEgZgQ1HarNyfx8v2RdtGFIOfOg1Y5Y/K6LXzjXu84Q4YRri8WJCcOZ4Q 1y/m3o94I= Received: from localhost.localdomain (unknown [183.157.98.195]) by smtp8 (Coremail) with SMTP id DMCowAD3_4Meraxc3d+KPQ--.36192S2; Tue, 09 Apr 2019 22:33:02 +0800 (CST) From: Li Qiang To: hemant.agrawal@nxp.com, shreyansh.jain@nxp.com Cc: dev@dpdk.org, liq3ea@gmail.com, Li Qiang Date: Tue, 9 Apr 2019 07:33:01 -0700 Message-Id: <20190409143301.16482-1-liq3ea@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: DMCowAD3_4Meraxc3d+KPQ--.36192S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr4fAr4fuw4fKF47Aw1xuFg_yoWfZFc_CF Wxt3yxtry5uFWxCa15ArW2vr1I9a93Wr1kZayFqr45CrsIvry3tF1UJFy7GwnxCrW7Wr9r Xw1UG343Cr18CjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUU0JmUUUUUU== X-Originating-IP: [183.157.98.195] X-CM-SenderInfo: 5oltjvrd6rljoofrz/xtbBZh6RbVaD02doAgAAsP X-Mailman-Approved-At: Tue, 09 Apr 2019 21:24:41 +0200 Subject: [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190409143301.r0ACZ_R1cmqQNg_3WD8JeUVIcQ7IzuWIZ6kGp8m2c_c@z> When 'rte_zmalloc' failed dpaa_mbuf_create_pool() forgets freeing 'bp' thus leading resource leak. This patch avoids this. Spotted by Coverity: CID 337679 Signed-off-by: Li Qiang --- drivers/mempool/dpaa/dpaa_mempool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index 003081772..3d5c0022c 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -78,8 +78,10 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp) rte_dpaa_bpid_info = (struct dpaa_bp_info *)rte_zmalloc(NULL, sizeof(struct dpaa_bp_info) * DPAA_MAX_BPOOLS, RTE_CACHE_LINE_SIZE); - if (rte_dpaa_bpid_info == NULL) + if (rte_dpaa_bpid_info == NULL) { + bman_free_pool(bp); return -ENOMEM; + }; } rte_dpaa_bpid_info[bpid].mp = mp; -- 2.17.1