After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 756762 - Leak fixes
Leak fixes
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Keyboard
unspecified
Other All
: Normal normal
: ---
Assigned To: Rui Matos
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-17 19:45 UTC by Christophe Fergeau
Modified: 2015-10-19 09:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build-sys: Call GNOME_DEBUG_CHECK before AC_PROG_CC (1.21 KB, patch)
2015-10-17 19:45 UTC, Christophe Fergeau
committed Details | Review
build-sys: Remove PKG_NAME from autogen.sh (934 bytes, patch)
2015-10-17 19:45 UTC, Christophe Fergeau
committed Details | Review
online-accounts: Remove unused private member (2.88 KB, patch)
2015-10-17 19:46 UTC, Christophe Fergeau
committed Details | Review
shell: Fix leak in cc_shell_item_view_update_cells (3.22 KB, patch)
2015-10-17 19:46 UTC, Christophe Fergeau
committed Details | Review
keyboard: Don't leak CcKeyboardItem::binding (2.83 KB, patch)
2015-10-17 19:46 UTC, Christophe Fergeau
committed Details | Review
keyboard: Fix leak in find_free_settings_path() (1.28 KB, patch)
2015-10-17 19:46 UTC, Christophe Fergeau
committed Details | Review
keyboard: Fix leak when loading sections (1.89 KB, patch)
2015-10-17 19:46 UTC, Christophe Fergeau
committed Details | Review
keyboard: Fix leak in settings_get_binding() (1.53 KB, patch)
2015-10-17 19:46 UTC, Christophe Fergeau
committed Details | Review

Description Christophe Fergeau 2015-10-17 19:45:49 UTC
Some leak fixes, mainly for the keyboard panel.
Comment 1 Christophe Fergeau 2015-10-17 19:45:53 UTC
Created attachment 313563 [details] [review]
build-sys: Call GNOME_DEBUG_CHECK before AC_PROG_CC

This avoids these warnings:
configure.ac:32: warning: AC_PROG_CC was called before AX_CHECK_ENABLE_DEBUG
aclocal.m4:316: AX_CHECK_ENABLE_DEBUG is expanded from...
aclocal.m4:390: GNOME_DEBUG_CHECK is expanded from...
Comment 2 Christophe Fergeau 2015-10-17 19:45:58 UTC
Created attachment 313564 [details] [review]
build-sys: Remove PKG_NAME from autogen.sh

This gets rid of this warning:
***Warning*** PKG_NAME is deprecated, you may remove it from autogen.sh
Comment 3 Christophe Fergeau 2015-10-17 19:46:03 UTC
Created attachment 313565 [details] [review]
online-accounts: Remove unused private member

This fixes this leak:

==21491== 384 (40 direct, 344 indirect) bytes in 1 blocks are definitely lost in loss record 18,518 of 19,643
==21491==    at 0x8792D3A: g_type_create_instance (gtype.c:1848)
==21491==    by 0x8779AC5: g_object_new_internal (gobject.c:1774)
==21491==    by 0x8779FD4: g_object_newv (gobject.c:1921)
==21491==    by 0x8779676: g_object_new (gobject.c:1614)
==21491==    by 0x747DFFC: gtk_list_store_new (gtkliststore.c:424)
==21491==    by 0x49C781: goa_panel_add_account_dialog_init (cc-online-accounts-add-account-dialog.c:300)
==21491==    by 0x8792E7D: g_type_create_instance (gtype.c:1870)
==21491==    by 0x8779AC5: g_object_new_internal (gobject.c:1774)
==21491==    by 0x877A71A: g_object_new_valist (gobject.c:2033)
==21491==    by 0x87796C5: g_object_new (gobject.c:1617)
==21491==    by 0x49CC26: goa_panel_add_account_dialog_new (cc-online-accounts-add-account-dialog.c:380)
==21491==    by 0x49B162: get_all_providers_cb (cc-online-accounts-panel.c:701)
==21491==    by 0x8426107: g_simple_async_result_complete (gsimpleasyncresult.c:801)
==21491==    by 0x8426153: complete_in_idle_cb (gsimpleasyncresult.c:813)
==21491==    by 0x8A0C470: g_idle_dispatch (gmain.c:5397)
==21491==    by 0x8A09AB8: g_main_dispatch (gmain.c:3122)
==21491==    by 0x8A0A8FC: g_main_context_dispatch (gmain.c:3737)
==21491==    by 0x8A0AAE0: g_main_context_iterate (gmain.c:3808)
==21491==    by 0x8A0ABA4: g_main_context_iteration (gmain.c:3869)
==21491==    by 0x846EE55: g_application_run (gapplication.c:2311)
==21491==    by 0x44CA4B: main (main.c:57)
=
Comment 4 Christophe Fergeau 2015-10-17 19:46:09 UTC
Created attachment 313566 [details] [review]
shell: Fix leak in cc_shell_item_view_update_cells

==11430== 48 (24 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 10,663 of 18,7
==11430==    at 0x4A06C50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==11430==    by 0x7F260AC: g_malloc (gmem.c:97)
==11430==    by 0x7F3F0F7: g_slice_alloc (gslice.c:1007)
==11430==    by 0x7F19BE5: g_list_prepend (glist.c:311)
==11430==    by 0x684843B: accum_cells (gtkcellarea.c:1563)
==11430==    by 0x6850989: gtk_cell_area_box_foreach (gtkcellareabox.c:1145)
==11430==    by 0x6848AAA: gtk_cell_area_foreach (gtkcellarea.c:1730)
==11430==    by 0x6848490: gtk_cell_area_get_cells (gtkcellarea.c:1573)
==11430==    by 0x6857339: gtk_cell_layout_get_cells (gtkcelllayout.c:592)
==11430==    by 0x685668F: gtk_cell_layout_default_get_cells (gtkcelllayout.c:342)
==11430==    by 0x6857339: gtk_cell_layout_get_cells (gtkcelllayout.c:592)
==11430==    by 0x45242B: cc_shell_item_view_update_cells (cc-shell-item-view.c:116)
==11430==    by 0x451DDD: cc_shell_category_view_constructed (cc-shell-category-view.c:141)
==11430==    by 0x7C8DC10: g_object_new_internal (gobject.c:1814)
==11430==    by 0x7C8E71A: g_object_new_valist (gobject.c:2033)
==11430==    by 0x7C8D6C5: g_object_new (gobject.c:1617)
==11430==    by 0x4520AB: cc_shell_category_view_new (cc-shell-category-view.c:213)
==11430==    by 0x44F5D2: add_category_view (cc-window.c:852)
==11430==    by 0x44F78B: setup_model (cc-window.c:880)
==11430==    by 0x450EBC: create_main_page (cc-window.c:1460)
==11430==    by 0x4514F1: create_window (cc-window.c:1553)
==11430==    by 0x45170A: cc_window_init (cc-window.c:1587)
==11430==    by 0x7CA6E7D: g_type_create_instance (gtype.c:1870)
==11430==    by 0x7C8DAC5: g_object_new_internal (gobject.c:1774)
==11430==    by 0x7C8E71A: g_object_new_valist (gobject.c:2033)
==11430==    by 0x7C8D6C5: g_object_new (gobject.c:1617)
==11430==    by 0x451847: cc_window_new (cc-window.c:1602)
==11430==    by 0x44D409: cc_application_startup (cc-application.c:262)
==11430==    by 0x7C8827D: g_cclosure_marshal_VOID__VOIDv (gmarshal.c:905)
==11430==    by 0x7C8590F: g_type_class_meta_marshalv (gclosure.c:1021)
==11430==    by 0x7C854D1: _g_closure_invoke_va (gclosure.c:864)
==11430==    by 0x7CA0771: g_signal_emit_valist (gsignal.c:3246)
==11430==    by 0x7CA18E9: g_signal_emit (gsignal.c:3393)
==11430==    by 0x7982671: g_application_register (gapplication.c:2015)
==11430==    by 0x79808D2: g_application_real_local_command_line (gapplication.c:983)
==11430==    by 0x68143D6: gtk_application_local_command_line (gtkapplication.c:638)
==11430==    by 0x7982D4D: g_application_run (gapplication.c:2280)
==11430==    by 0x44C96B: main (main.c:57)
=
Comment 5 Christophe Fergeau 2015-10-17 19:46:16 UTC
Created attachment 313567 [details] [review]
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)
=
Comment 6 Christophe Fergeau 2015-10-17 19:46:21 UTC
Created attachment 313568 [details] [review]
keyboard: Fix leak in find_free_settings_path()

==5944== 90 (16 direct, 74 indirect) bytes in 1 blocks are definitely lost in loss record 11,855 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 0x144982EC: g_variant_dup_strv (gvariant.c:1621)
==5944==    by 0x13EDF251: g_settings_get_strv (gsettings.c:2070)
==5944==    by 0x48D56E: find_free_settings_path (keyboard-shortcuts.c:1651)
==5944==    by 0x48D663: add_custom_shortcut (keyboard-shortcuts.c:1682)
==5944==    by 0x48DB04: add_button_clicked (keyboard-shortcuts.c:1788)
=
Comment 7 Christophe Fergeau 2015-10-17 19:46:27 UTC
Created attachment 313569 [details] [review]
keyboard: Fix leak when loading sections

This fixes:
==5944== 2,304 bytes in 5 blocks are definitely lost in loss record 15,724 of 16,045
==5944==    at 0x4C2AB9D: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5944==    by 0x1445F0B8: g_realloc (gmem.c:159)
==5944==    by 0x144217CF: g_array_maybe_expand (garray.c:779)
==5944==    by 0x14420C9F: g_array_append_vals (garray.c:418)
==5944==    by 0x48ACFA: append_sections_from_file (keyboard-shortcuts.c:558)
==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)
==5944==    by 0x44E6A6: item_activated_cb (cc-window.c:280)
Comment 8 Christophe Fergeau 2015-10-17 19:46:32 UTC
Created attachment 313570 [details] [review]
keyboard: Fix leak in settings_get_binding()

This fixes:
==5944== 64,392 bytes in 4,223 blocks are definitely lost in loss record 16,020 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 0x48FA9D: binding_changed (cc-keyboard-item.c:384)
==5944==    by 0x141C3E2F: g_cclosure_marshal_VOID__STRINGv (gmarshal.c:1794)
==5944==    by 0x141BFBE3: _g_closure_invoke_va (gclosure.c:864)
==5944==    by 0x141DA3E7: g_signal_emit_valist (gsignal.c:3292)
==5944==    by 0x141DB55F: g_signal_emit (gsignal.c:3439)
==5944==    by 0x13EDC81D: g_settings_real_change_event (gsettings.c:386)
=
Comment 9 Bastien Nocera 2015-10-18 13:01:31 UTC
Review of attachment 313563 [details] [review]:

Sure. The prefix is just "build:" though, not "build-sys:"
Comment 10 Bastien Nocera 2015-10-18 13:02:00 UTC
Review of attachment 313564 [details] [review]:

Sure, prefix again though.
Comment 11 Bastien Nocera 2015-10-18 13:02:54 UTC
Review of attachment 313565 [details] [review]:

Yep. Cherry-pick to gnome-3-16 if applicable as well.
Comment 12 Bastien Nocera 2015-10-18 13:03:27 UTC
Review of attachment 313566 [details] [review]:

To cherry-pick as well.
Comment 13 Bastien Nocera 2015-10-18 13:03:57 UTC
Review of attachment 313567 [details] [review]:

To cherry-pick too.
Comment 14 Bastien Nocera 2015-10-18 13:04:25 UTC
Review of attachment 313568 [details] [review]:

Yes, to cherry-pick.
Comment 15 Bastien Nocera 2015-10-18 13:04:49 UTC
Review of attachment 313569 [details] [review]:

Looks good, to cherry-pick.
Comment 16 Bastien Nocera 2015-10-18 13:05:10 UTC
Review of attachment 313570 [details] [review]:

Looks good too.
Comment 17 Christophe Fergeau 2015-10-19 09:20:06 UTC
Attachment 313565 [details] pushed as d289aa8 - online-accounts: Remove unused private member
Attachment 313566 [details] pushed as 3b5e7e1 - shell: Fix leak in cc_shell_item_view_update_cells
Attachment 313567 [details] pushed as baff31f - keyboard: Don't leak CcKeyboardItem::binding
Attachment 313568 [details] pushed as e235a8a - keyboard: Fix leak in find_free_settings_path()
Attachment 313569 [details] pushed as caacec3 - keyboard: Fix leak when loading sections
Attachment 313570 [details] pushed as 99ef490 - keyboard: Fix leak in settings_get_binding()