Skip to content

Fix some memory leaks

Gaël Bonithon requested to merge Tamaranch/xfconf:fix-mem-leaks into master

This fixes leaks that I've been seeing in the panel for a long time and that I've finally taken the trouble to fix. I'd always put it off because fixing especially the first one would cause other components to crash, which I was too lazy to investigate. It should be fine with this, but I think it's safer not to backport these changes to 4.18, at least in the short term (and I'd say never, since it's been running "trouble-free" like this for a long time).

The first leak is of this type:

==95728== 24 bytes in 1 blocks are definitely lost in loss record 2,831 of 9,293
==95728==    at 0x4848953: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==95728==    by 0x57C62BA: g_malloc0 (gmem.c:163)
==95728==    by 0x493EC39: xfconf_dup_value_array (xfconf-gvaluefuncs.c:588)
==95728==    by 0x4937FE1: xfconf_cache_lookup_locked (xfconf-cache.c:822)
==95728==    by 0x49386E7: xfconf_cache_lookup (xfconf-cache.c:856)
==95728==    by 0x4939134: xfconf_channel_get_internal (xfconf-channel.c:455)
==95728==    by 0x493A48C: xfconf_channel_get_property (xfconf-channel.c:1238)
==95728==    by 0x122BDA: panel_application_load_real (panel-application.c:385)
==95728==    by 0x52EDDFB: gdk_threads_dispatch_free (gdk.c:782)
==95728==    by 0x57B697C: UnknownInlinedFun (gmain.c:1758)
==95728==    by 0x57B697C: g_source_callback_unref (gmain.c:1751)
==95728==    by 0x57BAF9F: g_source_destroy_internal (gmain.c:1423)
==95728==    by 0x57BC070: g_main_dispatch.lto_priv.0 (gmain.c:3506)

The second leak is of this type:

==95728==    at 0x4848953: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==95728==    by 0x57C62BA: g_malloc0 (gmem.c:163)
==95728==    by 0x493ECAA: xfconf_gvariant_to_gvalue (xfconf-gvaluefuncs.c:603)
==95728==    by 0x49382FF: xfconf_cache_handle_property_changed (xfconf-cache.c:509)
==95728==    by 0x49382FF: xfconf_cache_proxy_signal_received_cb (xfconf-cache.c:586)
==95728==    by 0x58C26BF: g_closure_invoke (gclosure.c:832)
==95728==    by 0x58F0A35: signal_emit_unlocked_R.isra.0 (gsignal.c:3980)
==95728==    by 0x58E1A41: signal_emit_valist_unlocked (gsignal.c:3612)
==95728==    by 0x58E1C76: g_signal_emit_valist (gsignal.c:3355)
==95728==    by 0x58E1D33: g_signal_emit (gsignal.c:3675)
==95728==    by 0x569CA35: on_signal_received (gdbusproxy.c:890)
==95728==    by 0x5687FA7: emit_signal_instance_in_idle_cb (gdbusconnection.c:3802)
==95728==    by 0x57BBF68: g_main_dispatch.lto_priv.0 (gmain.c:3476

Merge request reports