summaryrefslogtreecommitdiff
path: root/lib/graph
diff options
context:
space:
mode:
authorPavan Nikhilesh <[email protected]>2024-11-01 13:07:37 +0530
committerDavid Marchand <[email protected]>2024-11-06 21:33:34 +0100
commit5e65cd4a722ec7f277a70447db318953252bf6f9 (patch)
tree3c05d75957b48ce74ccb1958f4c68b1abc830ccf /lib/graph
parentaf154d7a00441b54ea1439cbcd4b2d0e9fc0626a (diff)
graph: fix memory leak in node clone
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 <[email protected]> Reviewed-by: David Marchand <[email protected]> Acked-by: Kiran Kumar K <[email protected]>
Diffstat (limited to 'lib/graph')
-rw-r--r--lib/graph/node.c4
1 files 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: