From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B0BBA034E; Tue, 22 Feb 2022 19:19:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF9AD41159; Tue, 22 Feb 2022 19:18:52 +0100 (CET) Received: from out203-205-221-190.mail.qq.com (out203-205-221-190.mail.qq.com [203.205.221.190]) by mails.dpdk.org (Postfix) with ESMTP id 3FD2A41174 for ; Tue, 22 Feb 2022 19:18:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1645553929; bh=Xuj3KasZs2JjQfadj+76a0NMVuni+3ir6ZNwj8opn7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TBSTYvr1fxdQIzVipzPGbIUPJ3evDhCAoIYqu/UbVkI/9kNhcldJgCJ157rJ9f3pk RaDk6chnrBbkaB60j8bNWMiN+QgLE4zhLsOKc0ycLSfVJZ0WAA2mqc7eIy/J7XMwDN j1MJQZRC7+YQqvfsUzGEdaDpRyA1wxvbGzAD9aCk= Received: from localhost.localdomain ([111.193.130.237]) by newxmesmtplogicsvrszc6.qq.com (NewEsmtp) with SMTP id 49223207; Wed, 23 Feb 2022 02:18:18 +0800 X-QQ-mid: xmsmtpt1645553925tfsv9uksk Message-ID: X-QQ-XMAILINFO: ObFHHlrAm440vGD2CmL1GKPOwjXWz3zFUC2Osf47LjSuwV3E9tckEz/Hm8NmaH GSdtMjbBZzbFSeZEJL8Ndj8RgwR2ihL5nxmGEdOVHvBqDQuY37KNbrGUjibB/VtRzWsZdePxaxPZ Mp8KhY4cBrPeELELP3+p3QGl3iJhjzsqOWTqItI7uO715Kd0TOVqnsMCjvxqOrxfQE3S/3aWUYOj Xnb/W3xiLPAUKC84nbCfoQxC8aTReRMIoV9YSCtlfuRwzt8JJBynrZR4ftGCUU14yqXUJM2/mxYy CrUzRTJ1Em36OQ+mtm9oHeU2TDdQxt86vXvGvSQGGV4IvBYtTo4n8rg7xkQBy6xwYiq2w9gRHTGu npjdy8eDtuq8tG/3v0QBly9DnzLkr2oHbXD2+0uc6bRAJw7EhNUoPgn5zGU0S/7Kj0eNsiwzt+y/ Tmr2yLx0ketF/cyBb78Ersh9ZqQ0ILp/mRa/Z1CQK7hqGM54lKJWMBAdTC03fGWpKOyWJ2QUkiNX nYMB2F5N2eoyxrBqbHnzAr9RcjKfBArlGWBq+AAhh16tK9mnUd6+7FEWWIRpr122oaBcsyUro9ap MhxPodLci5VRCDTqGA50Jsq4r6L5uHJjRJCao4f4mfBmYi91i/t73k12jGLBVjtEYvHyZMxY9F2U K4Cu9tE8X0zH/TMKicpHr8ny9bhBgyP25/5D7EcXjiwBZLPHxQWRJgit6m3t/oddu33z/BRndkbp ocVkT6qRa8WkeYF1duQ0eKu6+kA4cUXsfiBAztgc18BgwNy7OXLLwh1hXxgZUuBwVc4FOtsZ5IQR JerTVVy1gT3fRAeaEj6alvcAdYc1mwE9i11foijCjxXifLmHoL5lWp3ap3/WW38K04OvbU+gK9/X QDOmtqtLow From: Weiguo Li To: dev@dpdk.org Cc: adypodoman@gmail.com, xiaoyun.li@intel.com, tianfei.zhang@intel.com, bruce.richardson@intel.com, ivan.malov@oktetlabs.ru, jgrajcia@cisco.com, hkalra@marvell.com, ying.a.wang@intel.com, ting.xu@intel.com, simei.su@intel.com, qiming.yang@intel.com, motih@mellanox.com, shreyansh.jain@nxp.com, skoteshwar@marvell.com, stephen@networkplumber.org, kalesh-anakkur.purayil@broadcom.com, somnath.kotur@broadcom.com, declan.doherty@intel.com, gakhil@marvell.com, nicolas.chautru@intel.com Subject: [PATCH 06/20] net/bnxt: fix 'ctx' memory leak when new malloc fail Date: Wed, 23 Feb 2022 02:18:04 +0800 X-OQ-MSGID: <76cf0a814b97095108961949e14e78ebf3ca1fa8.1645551559.git.liwg06@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When new memory is not available and the memory "ctx" allocated beforehand was not assigned to anywhere, so "ctx" should be freed, otherwise will cause a memory leak. Fixes: b4f740511655 ("net/bnxt: remove unnecessary return check") Signed-off-by: Weiguo Li --- drivers/net/bnxt/bnxt_hwrm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index b4aeec593e..4993111ccf 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -5374,6 +5374,7 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp) RTE_CACHE_LINE_SIZE); if (!ctx_pg) { rc = -ENOMEM; + rte_free(ctx); goto ctx_err; } for (i = 0; i < tqm_rings; i++, ctx_pg++) -- 2.25.1