[PATCH v2] graph: fix memory leak in node clone
Kiran Kumar Kokkilagadda
kirankumark at marvell.com
Tue Nov 5 14:34:25 CET 2024
> -----Original Message-----
> From: pbhagavatula at marvell.com <pbhagavatula at marvell.com>
> Sent: Friday, November 1, 2024 1:08 PM
> To: Jerin Jacob <jerinj at marvell.com>; chcchc88 at 163.com; Kiran Kumar
> Kokkilagadda <kirankumark at marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram at marvell.com>; Zhirun Yan <yanzhirun_163 at 163.com>
> Cc: dev at dpdk.org; Pavan Nikhilesh Bhagavatula
> <pbhagavatula at marvell.com>
> Subject: [PATCH v2] graph: fix memory leak in node clone
>
> 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>
> ---
Acked-by: Kiran Kumar Kokkilagadda <kirankumark 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