[PATCH 08/20] net/cnxk: free 'node' memory when node add fail

Weiguo Li liwg06 at foxmail.com
Tue Feb 22 19:18:06 CET 2022


When node_add failed and function return, then the memory of 'node'
is leaked.

Fixes: 4435371b8fb1c0 ("net/cnxk: add TM shaper and node operations")

Signed-off-by: Weiguo Li <liwg06 at foxmail.com>
---
 drivers/net/cnxk/cnxk_tm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/cnxk/cnxk_tm.c b/drivers/net/cnxk/cnxk_tm.c
index 9015a452f8..81afafd5b7 100644
--- a/drivers/net/cnxk/cnxk_tm.c
+++ b/drivers/net/cnxk/cnxk_tm.c
@@ -389,6 +389,7 @@ cnxk_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id,
 	if (rc < 0) {
 		error->type = roc_nix_tm_err_to_rte_err(rc);
 		error->message = roc_error_msg_get(rc);
+		rte_free(node);
 		return rc;
 	}
 	error->type = RTE_TM_ERROR_TYPE_NONE;
-- 
2.25.1



More information about the dev mailing list