[PATCH 1/4] tests: fix leaks in dbus-display-test

marcandre.lureau@redhat.com posted 4 patches 2 days, 22 hours ago
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH 1/4] tests: fix leaks in dbus-display-test
Posted by marcandre.lureau@redhat.com 2 days, 22 hours ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Close the connections and complete the method invocations.

Thanks ASAN for the report.

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

diff --git a/tests/qtest/dbus-display-test.c b/tests/qtest/dbus-display-test.c
index 1d5951b7117..5773776cad5 100644
--- a/tests/qtest/dbus-display-test.c
+++ b/tests/qtest/dbus-display-test.c
@@ -76,6 +76,7 @@ test_dbus_display_vm(void)
         qemu_dbus_display1_vm_get_name(QEMU_DBUS_DISPLAY1_VM(vm)),
         ==,
         "dbus-test");
+    g_clear_object(&conn);
     qtest_quit(qts);
 }
 
@@ -97,6 +98,8 @@ static gboolean listener_handle_scanout(
     GVariant *arg_data,
     TestDBusConsoleRegister *test)
 {
+    qemu_dbus_display1_listener_complete_scanout(object, invocation);
+
     if (!test->with_map) {
         g_main_loop_quit(test->loop);
     }
@@ -131,6 +134,9 @@ static gboolean listener_handle_scanout_map(
     g_assert_no_errno(addr == MAP_FAILED ? -1 : 0);
     g_assert_no_errno(munmap(addr, len));
 
+    qemu_dbus_display1_listener_unix_map_complete_scanout_map(object, invocation,
+                                                              NULL);
+
     g_main_loop_quit(test->loop);
 
     close(fd);
@@ -287,6 +293,7 @@ test_dbus_display_console(const void* data)
 
     g_clear_object(&test.server);
     g_clear_object(&test.listener_conn);
+    g_clear_object(&conn);
     qtest_quit(qts);
 }
 
@@ -322,6 +329,7 @@ test_dbus_display_keyboard(void)
         &err);
     if (g_error_matches(err, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) {
         g_test_skip("The VM doesn't have a console!");
+        g_clear_object(&conn);
         qtest_quit(qts);
         return;
     }
@@ -348,6 +356,7 @@ test_dbus_display_keyboard(void)
     g_assert_cmpint(qemu_dbus_display1_keyboard_get_modifiers(
                         QEMU_DBUS_DISPLAY1_KEYBOARD(keyboard)), ==, 0);
 
+    g_clear_object(&conn);
     qtest_quit(qts);
 }
 
-- 
2.52.0


Re: [PATCH 1/4] tests: fix leaks in dbus-display-test
Posted by Fabiano Rosas 1 day, 20 hours ago
marcandre.lureau@redhat.com writes:

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Close the connections and complete the method invocations.
>
> Thanks ASAN for the report.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/qtest/dbus-display-test.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/tests/qtest/dbus-display-test.c b/tests/qtest/dbus-display-test.c
> index 1d5951b7117..5773776cad5 100644
> --- a/tests/qtest/dbus-display-test.c
> +++ b/tests/qtest/dbus-display-test.c
> @@ -76,6 +76,7 @@ test_dbus_display_vm(void)
>          qemu_dbus_display1_vm_get_name(QEMU_DBUS_DISPLAY1_VM(vm)),
>          ==,
>          "dbus-test");
> +    g_clear_object(&conn);
>      qtest_quit(qts);
>  }
>  
> @@ -97,6 +98,8 @@ static gboolean listener_handle_scanout(
>      GVariant *arg_data,
>      TestDBusConsoleRegister *test)
>  {
> +    qemu_dbus_display1_listener_complete_scanout(object, invocation);
> +
>      if (!test->with_map) {
>          g_main_loop_quit(test->loop);
>      }
> @@ -131,6 +134,9 @@ static gboolean listener_handle_scanout_map(
>      g_assert_no_errno(addr == MAP_FAILED ? -1 : 0);
>      g_assert_no_errno(munmap(addr, len));
>  
> +    qemu_dbus_display1_listener_unix_map_complete_scanout_map(object, invocation,
> +                                                              NULL);
> +
>      g_main_loop_quit(test->loop);
>  
>      close(fd);
> @@ -287,6 +293,7 @@ test_dbus_display_console(const void* data)
>  
>      g_clear_object(&test.server);
>      g_clear_object(&test.listener_conn);
> +    g_clear_object(&conn);
>      qtest_quit(qts);
>  }
>  
> @@ -322,6 +329,7 @@ test_dbus_display_keyboard(void)
>          &err);
>      if (g_error_matches(err, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD)) {
>          g_test_skip("The VM doesn't have a console!");
> +        g_clear_object(&conn);
>          qtest_quit(qts);
>          return;
>      }
> @@ -348,6 +356,7 @@ test_dbus_display_keyboard(void)
>      g_assert_cmpint(qemu_dbus_display1_keyboard_get_modifiers(
>                          QEMU_DBUS_DISPLAY1_KEYBOARD(keyboard)), ==, 0);
>  
> +    g_clear_object(&conn);
>      qtest_quit(qts);
>  }

Acked-by: Fabiano Rosas <farosas@suse.de>