test/graph: fix memory leaks in functional tests
authorKiran Kumar K <kirankumark@marvell.com>
Fri, 15 May 2020 07:28:24 +0000 (12:58 +0530)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 15 May 2020 09:00:18 +0000 (11:00 +0200)
Fix memory leaks reported by Coverity.

Fixes: 6b89650418 ("test/graph: add functional tests")

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
app/test/test_graph.c

index dfb71b4..ed69eda 100644 (file)
@@ -497,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;
                }
 
@@ -506,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;
                        }
                }