[gnome-control-center] keyboard: Fix another memory leak
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Fix another memory leak
- Date: Wed, 5 Jul 2017 12:17:39 +0000 (UTC)
commit eed74317c41de82405795de180e37f45423b424b
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jun 30 18:06:52 2017 +0200
keyboard: Fix another memory leak
The memory leak fixed in commit 870fb462019 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
panels/keyboard/cc-keyboard-item.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c
index 619474c..d6f9938 100644
--- a/panels/keyboard/cc-keyboard-item.c
+++ b/panels/keyboard/cc-keyboard-item.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]