DPDK patches and discussions
 help / color / mirror / Atom feed
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Kiran Kumar K <kirankumark@marvell.com>,
	"Nithin Dabilpuram" <ndabilpuram@marvell.com>
Cc: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [dpdk-dev]  [PATCH] test/graph_perf: fix memory leaks
Date: Thu, 14 May 2020 02:26:00 +0530	[thread overview]
Message-ID: <20200513205600.6584-1-pbhagavatula@marvell.com> (raw)

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


             reply	other threads:[~2020-05-13 20:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 20:56 pbhagavatula [this message]
2020-05-15  5:26 ` Jerin Jacob
2020-05-15  8:13 ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200513205600.6584-1-pbhagavatula@marvell.com \
    --to=pbhagavatula@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).