DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] test/graph_perf: fix memory leaks
@ 2020-05-13 20:56 pbhagavatula
  2020-05-15  5:26 ` Jerin Jacob
  2020-05-15  8:13 ` David Marchand
  0 siblings, 2 replies; 3+ messages in thread
From: pbhagavatula @ 2020-05-13 20:56 UTC (permalink / raw)
  To: jerinj, Kiran Kumar K, Nithin Dabilpuram; +Cc: dev, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Fix memory leaks reported by coverity.

Coverity issue: 358440, 358441, 358446.
Fixes: 61d77071ab99 ("test/graph: add performance tests")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test/test_graph_perf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/app/test/test_graph_perf.c b/app/test/test_graph_perf.c
index 3089fb24c..296d99a9d 100644
--- a/app/test/test_graph_perf.c
+++ b/app/test/test_graph_perf.c
@@ -76,6 +76,8 @@ test_node_ctx_init(const struct rte_graph *graph, struct rte_node *node)
 	RTE_SET_USED(graph);
 
 	mz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ);
+	if (mz == NULL)
+		return -ENOMEM;
 	graph_data = mz->addr;
 	node_data = graph_get_node_data(graph_data, nid);
 	node->ctx[0] = node->nb_edges;
@@ -570,6 +572,7 @@ graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,
 	}
 	graph_data->graph_id = graph_id;
 
+	free(node_map);
 	for (i = 0; i < graph_data->nb_nodes; i++)
 		free(node_patterns[i]);
 	free(snk_nodes);
@@ -578,6 +581,7 @@ graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,
 	return 0;
 
 pattern_name_free:
+	free(node_map);
 	for (i = 0; i < graph_data->nb_nodes; i++)
 		free(node_patterns[i]);
 snk_free:
@@ -677,6 +681,8 @@ measure_perf(void)
 	struct test_graph_perf *graph_data;
 
 	mz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ);
+	if (mz == NULL)
+		return -ENOMEM;
 	graph_data = mz->addr;
 
 	return measure_perf_get(graph_data->graph_id);
-- 
2.26.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test/graph_perf: fix memory leaks
  2020-05-13 20:56 [dpdk-dev] [PATCH] test/graph_perf: fix memory leaks pbhagavatula
@ 2020-05-15  5:26 ` Jerin Jacob
  2020-05-15  8:13 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: Jerin Jacob @ 2020-05-15  5:26 UTC (permalink / raw)
  To: Pavan Nikhilesh, David Marchand, Thomas Monjalon
  Cc: Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram, dpdk-dev

On Thu, May 14, 2020 at 2:26 AM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Fix memory leaks reported by coverity.
>
> Coverity issue: 358440, 358441, 358446.

The last dot can be removed when merging.


> Fixes: 61d77071ab99 ("test/graph: add performance tests")
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>


Acked-by: Jerin Jacob <jerinj@marvell.com>



> ---
>  app/test/test_graph_perf.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/app/test/test_graph_perf.c b/app/test/test_graph_perf.c
> index 3089fb24c..296d99a9d 100644
> --- a/app/test/test_graph_perf.c
> +++ b/app/test/test_graph_perf.c
> @@ -76,6 +76,8 @@ test_node_ctx_init(const struct rte_graph *graph, struct rte_node *node)
>         RTE_SET_USED(graph);
>
>         mz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ);
> +       if (mz == NULL)
> +               return -ENOMEM;
>         graph_data = mz->addr;
>         node_data = graph_get_node_data(graph_data, nid);
>         node->ctx[0] = node->nb_edges;
> @@ -570,6 +572,7 @@ graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,
>         }
>         graph_data->graph_id = graph_id;
>
> +       free(node_map);
>         for (i = 0; i < graph_data->nb_nodes; i++)
>                 free(node_patterns[i]);
>         free(snk_nodes);
> @@ -578,6 +581,7 @@ graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks,
>         return 0;
>
>  pattern_name_free:
> +       free(node_map);
>         for (i = 0; i < graph_data->nb_nodes; i++)
>                 free(node_patterns[i]);
>  snk_free:
> @@ -677,6 +681,8 @@ measure_perf(void)
>         struct test_graph_perf *graph_data;
>
>         mz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ);
> +       if (mz == NULL)
> +               return -ENOMEM;
>         graph_data = mz->addr;
>
>         return measure_perf_get(graph_data->graph_id);
> --
> 2.26.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test/graph_perf: fix memory leaks
  2020-05-13 20:56 [dpdk-dev] [PATCH] test/graph_perf: fix memory leaks pbhagavatula
  2020-05-15  5:26 ` Jerin Jacob
@ 2020-05-15  8:13 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2020-05-15  8:13 UTC (permalink / raw)
  To: Pavan Nikhilesh
  Cc: Jerin Jacob Kollanukkaran, Kiran Kumar K, Nithin Dabilpuram, dev

On Wed, May 13, 2020 at 10:56 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Fix memory leaks reported by coverity.
>
> Coverity issue: 358440, 358441, 358446
> Fixes: 61d77071ab99 ("test/graph: add performance tests")
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied, thanks.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-15  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 20:56 [dpdk-dev] [PATCH] test/graph_perf: fix memory leaks pbhagavatula
2020-05-15  5:26 ` Jerin Jacob
2020-05-15  8:13 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).