[Qemu-devel] [PATCH v2 07/30] tests: fix endianness-test leaks

Marc-André Lureau posted 30 patches 8 years, 11 months ago
[Qemu-devel] [PATCH v2 07/30] tests: fix endianness-test leaks
Posted by Marc-André Lureau 8 years, 11 months ago
Spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/endianness-test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/endianness-test.c b/tests/endianness-test.c
index cf8d41b7b4..ed0bf52019 100644
--- a/tests/endianness-test.c
+++ b/tests/endianness-test.c
@@ -295,14 +295,17 @@ int main(int argc, char **argv)
         path = g_strdup_printf("endianness/%s",
                                test_cases[i].machine);
         qtest_add_data_func(path, &test_cases[i], test_endianness);
+        g_free(path);
 
         path = g_strdup_printf("endianness/split/%s",
                                test_cases[i].machine);
         qtest_add_data_func(path, &test_cases[i], test_endianness_split);
+        g_free(path);
 
         path = g_strdup_printf("endianness/combine/%s",
                                test_cases[i].machine);
         qtest_add_data_func(path, &test_cases[i], test_endianness_combine);
+        g_free(path);
     }
 
     return g_test_run();
-- 
2.11.0.295.gd7dffce1c.dirty


Re: [Qemu-devel] [PATCH v2 07/30] tests: fix endianness-test leaks
Posted by Philippe Mathieu-Daudé 8 years, 11 months ago
On 02/21/2017 11:14 AM, Marc-André Lureau wrote:
> Spotted by ASAN.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  tests/endianness-test.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tests/endianness-test.c b/tests/endianness-test.c
> index cf8d41b7b4..ed0bf52019 100644
> --- a/tests/endianness-test.c
> +++ b/tests/endianness-test.c
> @@ -295,14 +295,17 @@ int main(int argc, char **argv)
>          path = g_strdup_printf("endianness/%s",
>                                 test_cases[i].machine);
>          qtest_add_data_func(path, &test_cases[i], test_endianness);
> +        g_free(path);
>
>          path = g_strdup_printf("endianness/split/%s",
>                                 test_cases[i].machine);
>          qtest_add_data_func(path, &test_cases[i], test_endianness_split);
> +        g_free(path);
>
>          path = g_strdup_printf("endianness/combine/%s",
>                                 test_cases[i].machine);
>          qtest_add_data_func(path, &test_cases[i], test_endianness_combine);
> +        g_free(path);
>      }
>
>      return g_test_run();
>