From 1a814250c0f1cdf9fa870a6e051cac93e71b8e14 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Tue, 31 Jan 2023 09:42:11 +0100 Subject: [PATCH] tests/meta-context-test: Free D-Bus call results Don't leak the resulting `GVariant`. Part-of: --- src/tests/color-management-profile-conflict-test.c | 12 +++++++----- src/tests/meta-context-test.c | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/tests/color-management-profile-conflict-test.c b/src/tests/color-management-profile-conflict-test.c index d07ccc216..610158c6b 100644 --- a/src/tests/color-management-profile-conflict-test.c +++ b/src/tests/color-management-profile-conflict-test.c @@ -64,6 +64,7 @@ add_colord_system_profile (const char *cd_profile_id, GDBusProxy *proxy; g_autoptr (GError) error = NULL; GVariantBuilder params_builder; + g_autoptr (GVariant) ret = NULL; proxy = get_colord_mock_proxy (); @@ -71,11 +72,12 @@ add_colord_system_profile (const char *cd_profile_id, g_variant_builder_add (¶ms_builder, "s", cd_profile_id); g_variant_builder_add (¶ms_builder, "s", file_path); - if (!g_dbus_proxy_call_sync (proxy, - "AddSystemProfile", - g_variant_builder_end (¶ms_builder), - G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, - &error)) + ret = g_dbus_proxy_call_sync (proxy, + "AddSystemProfile", + g_variant_builder_end (¶ms_builder), + G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, + &error); + if (ret == NULL) g_error ("Failed to add system profile: %s", error->message); } diff --git a/src/tests/meta-context-test.c b/src/tests/meta-context-test.c index 97dd44566..89a4d00f7 100644 --- a/src/tests/meta-context-test.c +++ b/src/tests/meta-context-test.c @@ -390,10 +390,11 @@ meta_context_test_init (MetaContextTest *context_test) return; } - if (!g_dbus_proxy_call_sync (proxy, - "Reset", - NULL, - G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, - &error)) + ret = g_dbus_proxy_call_sync (proxy, + "Reset", + NULL, + G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, + &error); + if (ret == NULL) g_warning ("Failed to clear mocked color devices: %s", error->message); }