From: Weiguo Li <liwg06@foxmail.com>
To: ajit.khaparde@broadcom.com
Cc: kalesh-anakkur.purayil@broadcom.com, dev@dpdk.org
Subject: [PATCH] net/bnxt: fix a memory leak when new malloc fail
Date: Sat, 19 Feb 2022 02:05:18 +0800 [thread overview]
Message-ID: <tencent_60C640F1849CF244D8EA007DBB8D1089800A@qq.com> (raw)
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 <liwg06@foxmail.com>
---
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
reply other threads:[~2022-02-18 18:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_60C640F1849CF244D8EA007DBB8D1089800A@qq.com \
--to=liwg06@foxmail.com \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=kalesh-anakkur.purayil@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).