keyboard: Fix another memory leak

The memory leak fixed in commit 870fb46201 is still present in
a copy-pasted version of the function, apply the same fix there
as well ...

https://bugzilla.gnome.org/show_bug.cgi?id=784356
This commit is contained in:
Florian Müllner 2017-06-30 18:06:52 +02:00 committed by Georges Basile Stavracas Neto
parent 42489e2509
commit eed74317c4

View file

@ -63,12 +63,18 @@ G_DEFINE_TYPE (CcKeyboardItem, cc_keyboard_item, G_TYPE_OBJECT)
static const gchar *
get_binding_from_variant (GVariant *variant)
{
const char *str, **strv;
if (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING))
return g_variant_get_string (variant, NULL);
else if (g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING_ARRAY))
return g_variant_get_strv (variant, NULL)[0];
else
else if (!g_variant_is_of_type (variant, G_VARIANT_TYPE_STRING_ARRAY))
return "";
strv = g_variant_get_strv (variant, NULL);
str = strv[0];
g_free (strv);
return str;
}
static gboolean