Index: libxfce4util/xfce-rc-simple.c =================================================================== --- libxfce4util/xfce-rc-simple.c (revision 24693) +++ libxfce4util/xfce-rc-simple.c (working copy) @@ -124,6 +124,36 @@ static gchar* simple_escape (gchar static gboolean simple_write (XfceRcSimple *simple, const gchar *filename); +#if GLIB_CHECK_VERSION(2, 10, 0) +/* + * In glib >= 2.10.0, GMemChunk uses the g_slice allocator internally, and + * does not keep track of allocated memory segments. Because of this, + * g_mem_chunk_destroy() does not free memory allocated by the chunk, which + * leaks like crazy. Still use g_mem_chunk_free() here in the unlikely + * event that the bug in glib ever gets fixed; that way there won't be crashes + * due to double free()s. + */ +static void +simple_free_all_groups(XfceRcSimple *simple) +{ + Group *group; + Entry *entry; + LEntry *lentry; + + for (group = simple->gfirst; group; group = group->next) + { + for (entry = group->efirst; entry; entry = entry->next) + { + for (lentry = entry->lfirst; lentry; lentry = lentry->next) + { + g_mem_chunk_free (simple->lentry_chunk, lentry); + } + g_mem_chunk_free (simple->entry_chunk, entry); + } + g_mem_chunk_free (simple->group_chunk, group); + } +} +#endif static Group* simple_add_group (XfceRcSimple *simple, const gchar *name) @@ -660,6 +690,10 @@ _xfce_rc_simple_close (XfceRc *rc) { XfceRcSimple *simple = XFCE_RC_SIMPLE (rc); +#if GLIB_CHECK_VERSION(2, 10, 0) + simple_free_all_groups(simple); +#endif + if (!simple->shared_chunks) { g_mem_chunk_destroy (simple->entry_chunk);