The Leonis resource ops table is allocated with calloc(). If Tx/Rx ops
setup fails, the error path releases the table with rte_free().
Free the table with free() and clear the pointer on setup failure.
Fixes: c2d6a1b7a491 ("net/nbl: add resource layer")
Cc: [email protected]
Signed-off-by: Dimon Zhao <[email protected]>
---
drivers/net/nbl/nbl_hw/nbl_hw_leonis/nbl_res_leonis.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nbl/nbl_hw/nbl_hw_leonis/nbl_res_leonis.c
b/drivers/net/nbl/nbl_hw/nbl_hw_leonis/nbl_res_leonis.c
index 5d40d4f..6f06943 100644
--- a/drivers/net/nbl/nbl_hw/nbl_hw_leonis/nbl_res_leonis.c
+++ b/drivers/net/nbl/nbl_hw/nbl_hw_leonis/nbl_res_leonis.c
@@ -151,7 +151,8 @@ static int nbl_res_setup_ops(struct nbl_resource_ops_tbl
**res_ops_tbl,
return ret;
set_ops_failed:
- rte_free(*res_ops_tbl);
+ free(*res_ops_tbl);
+ *res_ops_tbl = NULL;
return ret;
}
--
2.53.0