* [PATCH] net/bnxt: fix a memory leak when new malloc fail
@ 2022-02-18 18:05 Weiguo Li
0 siblings, 0 replies; only message in thread
From: Weiguo Li @ 2022-02-18 18:05 UTC (permalink / raw)
To: ajit.khaparde; +Cc: kalesh-anakkur.purayil, dev
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-18 18:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 18:05 [PATCH] net/bnxt: fix a memory leak when new malloc fail Weiguo Li
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).