[gnome-control-center/gnome-3-16] keyboard: Don't leak CcKeyboardItem::binding
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-16] keyboard: Don't leak CcKeyboardItem::binding
- Date: Mon, 19 Oct 2015 09:33:58 +0000 (UTC)
commit 17455cd16d77ab0a995b505cc45c31b3768d01b9
Author: Christophe Fergeau <cfergeau redhat com>
Date: Sun Jun 21 11:32:39 2015 +0200
keyboard: Don't leak CcKeyboardItem::binding
It contains a strdup'ed string, but it's overwritten without being freed
first from cc_keyboard_item_load_from_gsettings_path() and
cc_keyboard_item_load_from_gsettings().
This fixes:
==5944== 976 bytes in 64 blocks are definitely lost in loss record 15,439 of 16,045
==5944== at 0x4C28C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5944== by 0x1445EFCC: g_malloc (gmem.c:94)
==5944== by 0x1445F2AE: g_malloc_n (gmem.c:330)
==5944== by 0x144981DC: g_variant_get_strv (gvariant.c:1572)
==5944== by 0x48FA45: settings_get_binding (cc-keyboard-item.c:369)
==5944== by 0x48FDDD: cc_keyboard_item_load_from_gsettings (cc-keyboard-item.c:438)
==5944== by 0x489EB7: append_section (keyboard-shortcuts.c:249)
==5944== by 0x48ADF6: append_sections_from_file (keyboard-shortcuts.c:578)
==5944== by 0x48B4EE: reload_sections (keyboard-shortcuts.c:737)
==5944== by 0x48EA22: keyboard_shortcuts_init (keyboard-shortcuts.c:2109)
==5944== by 0x489236: cc_keyboard_panel_constructor (cc-keyboard-panel.c:133)
==5944== by 0x141C7C3F: g_object_new_with_custom_constructor (gobject.c:1697)
==5944== by 0x141C7E71: g_object_new_internal (gobject.c:1777)
==5944== by 0x141C8ADA: g_object_new_valist (gobject.c:2038)
==5944== by 0x141C7A85: g_object_new (gobject.c:1622)
==5944== by 0x4547DF: cc_panel_loader_load_by_name (cc-panel-loader.c:213)
==5944== by 0x44DFCB: activate_panel (cc-window.c:157)
==5944== by 0x4504D6: cc_window_set_active_panel_from_id (cc-window.c:1036)
https://bugzilla.gnome.org/show_bug.cgi?id=756762
panels/keyboard/cc-keyboard-item.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c
index b8fad76..7cafa8d 100644
--- a/panels/keyboard/cc-keyboard-item.c
+++ b/panels/keyboard/cc-keyboard-item.c
@@ -420,6 +420,7 @@ cc_keyboard_item_load_from_gsettings_path (CcKeyboardItem *item,
g_settings_bind (item->settings, "command",
G_OBJECT (item), "command", G_SETTINGS_BIND_DEFAULT);
+ g_free (item->binding);
item->binding = settings_get_binding (item->settings, item->key);
binding_from_string (item->binding, &item->keyval, &item->keycode, &item->mask);
g_signal_connect (G_OBJECT (item->settings), "changed::binding",
@@ -441,6 +442,7 @@ cc_keyboard_item_load_from_gsettings (CcKeyboardItem *item,
item->description = g_strdup (description);
item->settings = g_settings_new (item->schema);
+ g_free (item->binding);
item->binding = settings_get_binding (item->settings, item->key);
item->editable = g_settings_is_writable (item->settings, item->key);
binding_from_string (item->binding, &item->keyval, &item->keycode, &item->mask);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]