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
This commit is contained in:
parent
3b5e7e1805
commit
baff31f43e
1 changed files with 2 additions and 0 deletions
|
@ -413,6 +413,7 @@ cc_keyboard_item_load_from_gsettings_path (CcKeyboardItem *item,
|
||||||
g_settings_bind (item->settings, "command",
|
g_settings_bind (item->settings, "command",
|
||||||
G_OBJECT (item), "command", G_SETTINGS_BIND_DEFAULT);
|
G_OBJECT (item), "command", G_SETTINGS_BIND_DEFAULT);
|
||||||
|
|
||||||
|
g_free (item->priv->binding);
|
||||||
item->priv->binding = settings_get_binding (item->settings, item->key);
|
item->priv->binding = settings_get_binding (item->settings, item->key);
|
||||||
binding_from_string (item->priv->binding, &item->keyval,
|
binding_from_string (item->priv->binding, &item->keyval,
|
||||||
&item->keycode, &item->mask);
|
&item->keycode, &item->mask);
|
||||||
|
@ -435,6 +436,7 @@ cc_keyboard_item_load_from_gsettings (CcKeyboardItem *item,
|
||||||
item->description = g_strdup (description);
|
item->description = g_strdup (description);
|
||||||
|
|
||||||
item->settings = g_settings_new (item->schema);
|
item->settings = g_settings_new (item->schema);
|
||||||
|
g_free (item->priv->binding);
|
||||||
item->priv->binding = settings_get_binding (item->settings, item->key);
|
item->priv->binding = settings_get_binding (item->settings, item->key);
|
||||||
item->editable = g_settings_is_writable (item->settings, item->key);
|
item->editable = g_settings_is_writable (item->settings, item->key);
|
||||||
binding_from_string (item->priv->binding, &item->keyval,
|
binding_from_string (item->priv->binding, &item->keyval,
|
||||||
|
|
Loading…
Add table
Reference in a new issue