tests/meta-context-test: Free D-Bus call results

Don't leak the resulting `GVariant`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2817>
This commit is contained in:
Niels De Graef 2023-01-31 09:42:11 +01:00 committed by Marge Bot
parent 678bc69e72
commit 1a814250c0
2 changed files with 13 additions and 10 deletions

View File

@ -64,6 +64,7 @@ add_colord_system_profile (const char *cd_profile_id,
GDBusProxy *proxy; GDBusProxy *proxy;
g_autoptr (GError) error = NULL; g_autoptr (GError) error = NULL;
GVariantBuilder params_builder; GVariantBuilder params_builder;
g_autoptr (GVariant) ret = NULL;
proxy = get_colord_mock_proxy (); proxy = get_colord_mock_proxy ();
@ -71,11 +72,12 @@ add_colord_system_profile (const char *cd_profile_id,
g_variant_builder_add (&params_builder, "s", cd_profile_id); g_variant_builder_add (&params_builder, "s", cd_profile_id);
g_variant_builder_add (&params_builder, "s", file_path); g_variant_builder_add (&params_builder, "s", file_path);
if (!g_dbus_proxy_call_sync (proxy, ret = g_dbus_proxy_call_sync (proxy,
"AddSystemProfile", "AddSystemProfile",
g_variant_builder_end (&params_builder), g_variant_builder_end (&params_builder),
G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL,
&error)) &error);
if (ret == NULL)
g_error ("Failed to add system profile: %s", error->message); g_error ("Failed to add system profile: %s", error->message);
} }

View File

@ -390,10 +390,11 @@ meta_context_test_init (MetaContextTest *context_test)
return; return;
} }
if (!g_dbus_proxy_call_sync (proxy, ret = g_dbus_proxy_call_sync (proxy,
"Reset", "Reset",
NULL, NULL,
G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL,
&error)) &error);
if (ret == NULL)
g_warning ("Failed to clear mocked color devices: %s", error->message); g_warning ("Failed to clear mocked color devices: %s", error->message);
} }