> -----Original Message-----
> From: Min Hu (Connor) <[email protected]>
> Sent: Thursday, April 22, 2021 5:22 PM
> To: [email protected]
> Cc: [email protected]; Jerin Jacob Kollanukkaran <[email protected]>;
> Kiran Kumar Kokkilagadda <[email protected]>
> Subject: [EXT] [PATCH 1/2] graph: fix memory leak
>
> External Email
>
> ----------------------------------------------------------------------
> From: HongBo Zheng <[email protected]>
>
> Fix function 'stats_mem_populate' return without free dynamic memory
> referenced by 'stats'.
>
> Fixes: af1ae8b6a32c ("graph: implement stats")
> Cc: [email protected]
>
> Signed-off-by: HongBo Zheng <[email protected]>
> Signed-off-by: Min Hu (Connor) <[email protected]>
> ---
> lib/librte_graph/graph_stats.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_graph/graph_stats.c b/lib/librte_graph/graph_stats.c
> index
> 125e08d..f698bb3 100644
> --- a/lib/librte_graph/graph_stats.c
> +++ b/lib/librte_graph/graph_stats.c
> @@ -174,7 +174,7 @@ stats_mem_populate(struct rte_graph_cluster_stats
> **stats_in,
> cluster->stat.hz = rte_get_timer_hz();
> node = graph_node_id_to_ptr(graph, id);
> if (node == NULL)
> - SET_ERR_JMP(ENOENT, err, "Failed to find node %s in graph
> %s",
> + SET_ERR_JMP(ENOENT, free, "Failed to find node %s in graph
> %s",
> graph_node->node->name, graph->name);
> cluster->nodes[cluster->nb_nodes++] = node;
>
> @@ -183,6 +183,8 @@ stats_mem_populate(struct rte_graph_cluster_stats
> **stats_in,
> *stats_in = stats;
>
> return 0;
> +free:
> + free(stats);
> err:
> return -rte_errno;
> }
> --
> 2.7.4
Reviewed-by: Kiran Kumar K <[email protected]>