[06/20] net/bnxt: fix 'ctx' memory leak when new malloc fail
Checks
Commit Message
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(+)
@@ -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++)