test/graph: fix memory leak
PATCH v2 1/1 test/graph: fix memory leak
From: Kiran Kumar K <[email protected]>
Fix memory leaks reported by coverity.
Coverity issue: 358439, 358451, 358448.
---
V2 changes:
* Added Coverity issue and Fixes info.
app/test/test_graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
app/test/test_graph.c +5 -2
@@ -12,6 +12,7 @@#include <rte_graph.h> #include <rte_graph_worker.h> #include <rte_mbuf.h> +#include <rte_random.h> #include "test.h"
@@ -145,7 +146,7 @@ uint16_t test_node_worker_source(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { - uint32_t obj_node0 = rand() % 100, obj_node1; + uint32_t obj_node0 = rte_rand() % 100, obj_node1;test_main_t *tm = &test_main;struct rte_mbuf *data;void **next_stream;
@@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,test_main_t *tm = &test_main;if (*(uint32_t *)node->ctx == test_node0.id) { -uint32_t obj_node0 =rand () %100 , obj_node1; +uint32_t obj_node0 =rte_rand () %100 , obj_node1;struct rte_mbuf *data;uint8_t second_pass =0 ;uint32_t count =0 ;
@@ -496,6 +497,7 @@ test_lookup_functions(void)printf ("Test number of edges for node = %s failed Expected = %d, got %d\n" , tm->test_node[i].node.name, tm->test_node[i].node.nb_edges, count); +free (next_edges);return -1 ; }
@@ -505,6 +507,7 @@ test_lookup_functions(void)printf ("Edge name miss match, expected = %s got = %s\n" , tm->test_node[i].node.next_nodes[j], next_edges[j]); +free (next_edges);return -1 ; } }
--
2.17.1
Quoted 6 lines · On Thu, May 14, 2020 at 10:57 AM <[email protected]> wrote:
From: Kiran Kumar K <[email protected]>
Fix memory leaks reported by coverity.
Coverity issue: 358439, 358451, 358448.
Please no '.' at the end of a tag (and sorting would not hurt).
I wanted to get a look at those, but I can't find them in coverity webui. Maybe those issues have been closed, but then I can't look at them.. ? Any help would be appreciated.
Quoted 23 lines
Fixes 6b89650418("test/graph: add functional tests")Signed-off-by Kiran Kumar K <[email protected]>---
V2 changes:
* Added Coverity issue and Fixes info.app/test/test_graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)app/test/test_graph.c +1
-0@@ -12,6 +12,7 @@#include <rte_graph.h> #include <rte_graph_worker.h> #include <rte_mbuf.h> +#include <rte_random.h> #include "test.h"
app/test/test_graph.c uint16_t · line 149
Quoted 5 lines
app/test/test_graph.c +1
-1@@ -145,7 +146,7 @@ uint16_t test_node_worker_source(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { - uint32_t obj_node0 = rand() % 100, obj_node1; + uint32_t obj_node0 = rte_rand() % 100, obj_node1;
The commitlog indicates memory leaks, I am a bit surprised to see this change. What is the rationale?
app/test/test_graph.c test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, · line 197
Quoted 9 lines
app/test/test_graph.c +1
-1test_main_t *tm = &test_main;struct rte_mbuf *data;void **next_stream;@@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,test_main_t *tm = &test_main;if (*(uint32_t *)node->ctx == test_node0.id) { -uint32_t obj_node0 =rand () %100 , obj_node1; +uint32_t obj_node0 =rte_rand () %100 , obj_node1;
Idem.
Quoted 22 lines
app/test/test_graph.c +2
-1struct rte_mbuf *data;uint8_t second_pass =0 ;uint32_t count =0 ;@@ -496,6 +497,7 @@ test_lookup_functions(void)printf ("Test number of edges for node = %s failed Expected = %d, got %d\n" , tm->test_node[i].node.name, tm->test_node[i].node.nb_edges, count); +free (next_edges);return -1 ; }@@ -505,6 +507,7 @@ test_lookup_functions(void)printf ("Edge name miss match, expected = %s got = %s\n" , tm->test_node[i].node.next_nodes[j], next_edges[j]); +free (next_edges);return -1 ; } } --2.17.1
Signature · 1 line
David Marchand
Quoted 16 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, May 14, 2020 4:34 PM
To: Kiran Kumar Kokkilagadda <[email protected]>
Cc: Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; dev <[email protected]>; Mcnamara, John <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2] test/graph: fix memory leakExternal Email
----------------------------------------------------------------------
Quoted 1 line · On Thu, May 14, 2020 at 10:57 AM <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
From: Kiran Kumar K <[email protected]>
Fix memory leaks reported by coverity.
Coverity issue: 358439, 358451, 358448.
Please no '.' at the end of a tag (and sorting would not hurt).
Will fix in V3.
Quoted 27 lines
I wanted to get a look at those, but I can't find them in coverity webui. Maybe those issues have been closed, but then I can't look at them.. ? Any help would be appreciated.
Quoted 22 lines
Fixes 6b89650418("test/graph: add functional tests")Signed-off-by Kiran Kumar K <[email protected]>---
V2 changes:
* Added Coverity issue and Fixes info.app/test/test_graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)app/test/test_graph.c index renamed from app/test/test_graph.c +0
-0
cf6df0744..ed69eda99100644app/test/test_graph.c +1
-0@@ -12,6 +12,7 @@#include <rte_graph.h> #include <rte_graph_worker.h> #include <rte_mbuf.h> +#include <rte_random.h> #include "test.h"
Quoted 9 lines
app/test/test_graph.c uint16_t · line 148
Quoted 5 lines
app/test/test_graph.c +1
-1@@ -145,7 +146,7 @@ uint16_t test_node_worker_source(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { - uint32_t obj_node0 = rand() % 100, obj_node1; + uint32_t obj_node0 = rte_rand() % 100, obj_node1;The commitlog indicates memory leaks, I am a bit surprised to see this change. What is the rationale?
Merged all the coverity issues to single patch. Will change the description in V3.
Quoted 42 lines
app/test/test_graph.c test_node0_worker(struct rte_graph *graph, struct
Quoted 5 lines
app/test/test_graph.c +0
-0test_main_t *tm = &test_main;struct rte_mbuf *data;void **next_stream;@@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct
rte_node*node, void **objs,app/test/test_graph.c test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, · line 197
Quoted 5 lines
app/test/test_graph.c +1
-1test_main_t *tm = &test_main;if (*(uint32_t *)node->ctx == test_node0.id) { -uint32_t obj_node0 =rand () %100 , obj_node1; +uint32_t obj_node0 =rte_rand () %100 , obj_node1;Idem.
app/test/test_graph.c test_lookup_functions(void) · line 497
Quoted 5 lines
app/test/test_graph.c +0
-0struct rte_mbuf *data;uint8_t second_pass =0 ;uint32_t count =0 ;@@ -496,6 +497,7 @@ test_lookup_functions(void) printf("Test number of edges for node = %s failed Expected = %d,got %d\n",
Quoted 15 lines
app/test/test_graph.c +2
-1tm->test_node[i].node.name, tm->test_node[i].node.nb_edges, count); +free (next_edges);return -1 ; }@@ -505,6 +507,7 @@ test_lookup_functions(void)printf ("Edge name miss match, expected = %s got = %s\n" , tm->test_node[i].node.next_nodes[j], next_edges[j]); +free (next_edges);return -1 ; } } --Quoted 2 lines
2.17.1
--
David Marchand