flash: Fix GVariant leaks

All functions used there are transfer: full but only two of
them were freed.
This commit is contained in:
Guido Günther
2021-11-16 14:47:54 +01:00
parent 9c5b9d67aa
commit c6db1ab680

View File

@@ -140,22 +140,20 @@ static void
brightness_received(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) brightness_received(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data)
{ {
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
GVariant *result = g_dbus_proxy_call_finish(proxy, res, &error); g_autoptr(GVariant) result = g_dbus_proxy_call_finish(proxy, res, &error);
if (!result) { if (!result) {
printf("Failed to get display brightness: %s\n", error->message); printf("Failed to get display brightness: %s\n", error->message);
return; return;
} }
GVariant *values = g_variant_get_child_value(result, 0); g_autoptr(GVariant) values = g_variant_get_child_value(result, 0);
if (g_variant_n_children(values) == 0) { if (g_variant_n_children(values) == 0) {
return; return;
} }
GVariant *brightness = g_variant_get_child_value(values, 0); g_autoptr(GVariant) brightness = g_variant_get_child_value(values, 0);
dbus_old_brightness = g_variant_get_int32(brightness); dbus_old_brightness = g_variant_get_int32(brightness);
g_variant_unref(result);
} }
static bool static bool