[PATCH v2] graph: fix memory leak in node clone
pbhagavatula at marvell.com
pbhagavatula at marvell.com
Fri Nov 1 08:37:37 CET 2024
From: Pavan Nikhilesh <pbhagavatula at marvell.com>
Free memory allocated for the node when xstats memory
allocation fails.
Coverity issue: 445529
Fixes: 070db97e017b ("graph: support node xstats")
Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
---
v2 Changes:
- Fix one more leak. (Huichao cai)
lib/graph/node.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/graph/node.c b/lib/graph/node.c
index f15922892e..63db629da8 100644
--- a/lib/graph/node.c
+++ b/lib/graph/node.c
@@ -156,7 +156,7 @@ node_clone(struct node *node, const char *name)
(node->xstats->nb_xstats * RTE_NODE_XSTAT_DESC_SIZE));
if (reg->xstats == NULL) {
rte_errno = ENOMEM;
- goto fail;
+ goto free;
}
for (i = 0; i < node->xstats->nb_xstats; i++)
@@ -178,7 +178,7 @@ node_clone(struct node *node, const char *name)
/* Naming ceremony of the new node. name is node->name + "-" + name */
if (clone_name(reg->name, node->name, name))
- goto free;
+ goto free_xstat;
rc = __rte_node_register(reg);
free_xstat:
--
2.25.1
More information about the dev
mailing list