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 F3423A0096 for ; Tue, 9 Apr 2019 21:24:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8BE8558EC; Tue, 9 Apr 2019 21:24:51 +0200 (CEST) Received: from m12-13.163.com (m12-13.163.com [220.181.12.13]) by dpdk.org (Postfix) with ESMTP id 76D1A4F93 for ; Tue, 9 Apr 2019 16:56:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=e83WWGqPABOrpvFFVJ E7YEtqNf4KROYM6P5S471JE8g=; b=PZH9pHFFgG7Yf1tq21hMJsUt5EAN1eIbVO Ep6V0njNIDyt3qEIC9JvrKjOh53x4hRs9/tk1B1Oer1k+NerZdrVqfu3eR0Zl2mQ 1MQgJS8QJo4KdlVpuDE2+5TQRoLWgpw/pu4/Nd3JkcinyLbjebWZFRFqIf5lOuS4 ZgwYVrZHs= Received: from localhost.localdomain (unknown [183.157.98.195]) by smtp9 (Coremail) with SMTP id DcCowACHLm+XsqxcHt88BA--.813S2; Tue, 09 Apr 2019 22:56:27 +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:56:21 -0700 Message-Id: <20190409145621.3099-1-liq3ea@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: DcCowACHLm+XsqxcHt88BA--.813S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr4fAr4fuw4fKF47Aw1xuFg_yoWfZFb_CF WxtrWxtry5uFWxCa15ArW2vr1I9a97Wr1kZa1Fqr45CrnIvry3tF1UJFy7GwnxCrW7Wr9r Xw1UG343Cr1rCjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjOB_UUUUUU== X-Originating-IP: [183.157.98.195] X-CM-SenderInfo: 5oltjvrd6rljoofrz/xtbBaxKRbVetuw1BgwABsK X-Mailman-Approved-At: Tue, 09 Apr 2019 21:24:41 +0200 Subject: [dpdk-dev] [PATCH v2] 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: <20190409145621.V-DwjDXniHgSvh-poDuMHAlFPNOD8reoF6XVuWz6mHE@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..54cdf37e8 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