tests: test-qgraph: fix a memory leak
PATCH 1/1 tests: test-qgraph: fix a memory leak
Spotted by ASAN when 'make check'.
Signed-off-by Li Qiang <[email protected]>
--- tests/test-qgraph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/test-qgraph.c +2 -1
@@ -122,7 +122,7 @@ static void check_driver(const char *driver)static void check_test (const char *test,const char *interface) {QOSGraphEdge *edge; -const char *full_name =g_strdup_printf ("%s-tests/%s" , interface, test); +char *full_name =g_strdup_printf ("%s-tests/%s" , interface, test);qos_add_test (test, interface, testfunct,NULL ); g_assert_cmpint(qos_graph_has_machine(test), ==, FALSE);
@@ -138,6 +138,7 @@ static void check_test(const char *test, const char *interface) g_assert_cmpint(qos_graph_get_node_availability(full_name), ==, TRUE);qos_graph_node_set_availability (full_name, FALSE); g_assert_cmpint(qos_graph_get_node_availability(full_name), ==, FALSE); +g_free (full_name); }static void count_each_test (QOSGraphNode *path,int len)
Signature · 1 line
2.17.1
Quoted 22 lines · Li Qiang
Spotted by ASAN when 'make check'.
Signed-off-by Li Qiang <[email protected]>--- tests/test-qgraph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tests/test-qgraph.c +1
-1@@ -122,7 +122,7 @@ static void check_driver(const char *driver)static void check_test (const char *test,const char *interface) {QOSGraphEdge *edge; -const char *full_name =g_strdup_printf ("%s-tests/%s" , interface, test); +char *full_name =g_strdup_printf ("%s-tests/%s" , interface, test);qos_add_test (test, interface, testfunct,NULL ); g_assert_cmpint(qos_graph_has_machine(test), ==, FALSE);
tests/test-qgraph.c static void check_test(const char *test, const char *interface) · line 144
Quoted 7 lines
tests/test-qgraph.c +1
-0@@ -138,6 +138,7 @@ static void check_test(const char *test, const char *interface) g_assert_cmpint(qos_graph_get_node_availability(full_name), ==, TRUE);qos_graph_node_set_availability (full_name, FALSE); g_assert_cmpint(qos_graph_get_node_availability(full_name), ==, FALSE); +g_free (full_name); }static void count_each_test (QOSGraphNode *path,int len)
Reviewed-by Thomas Huth <[email protected]>
Quoted 2 lines · Li Qiang
Spotted by ASAN when 'make check'.
Fixes fc281c80202
Quoted 1 line
Signed-off-by Li Qiang <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 26 lines
--- tests/test-qgraph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tests/test-qgraph.c +2
-1@@ -122,7 +122,7 @@ static void check_driver(const char *driver)static void check_test (const char *test,const char *interface) {QOSGraphEdge *edge; -const char *full_name =g_strdup_printf ("%s-tests/%s" , interface, test); +char *full_name =g_strdup_printf ("%s-tests/%s" , interface, test);qos_add_test (test, interface, testfunct,NULL ); g_assert_cmpint(qos_graph_has_machine(test), ==, FALSE);@@ -138,6 +138,7 @@ static void check_test(const char *test, const char *interface) g_assert_cmpint(qos_graph_get_node_availability(full_name), ==, TRUE);qos_graph_node_set_availability (full_name, FALSE); g_assert_cmpint(qos_graph_get_node_availability(full_name), ==, FALSE); +g_free (full_name); }static void count_each_test (QOSGraphNode *path,int len)
Paolo Bonzini
AppliedQuoted 22 lines · Li Qiang
Spotted by ASAN when 'make check'.
Signed-off-by Li Qiang <[email protected]>--- tests/test-qgraph.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tests/test-qgraph.c +1
-1@@ -122,7 +122,7 @@ static void check_driver(const char *driver)static void check_test (const char *test,const char *interface) {QOSGraphEdge *edge; -const char *full_name =g_strdup_printf ("%s-tests/%s" , interface, test); +char *full_name =g_strdup_printf ("%s-tests/%s" , interface, test);qos_add_test (test, interface, testfunct,NULL ); g_assert_cmpint(qos_graph_has_machine(test), ==, FALSE);
tests/test-qgraph.c static void check_test(const char *test, const char *interface) · line 144
Quoted 7 lines
tests/test-qgraph.c +1
-0@@ -138,6 +138,7 @@ static void check_test(const char *test, const char *interface) g_assert_cmpint(qos_graph_get_node_availability(full_name), ==, TRUE);qos_graph_node_set_availability (full_name, FALSE); g_assert_cmpint(qos_graph_get_node_availability(full_name), ==, FALSE); +g_free (full_name); }static void count_each_test (QOSGraphNode *path,int len)
Queued, thanks.
Paolo