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 <liw...@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