From 30aeb243883704e32b53dfe6fa801c439f869b21 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 19 Feb 2003 00:42:04 +0000 Subject: [PATCH] * util.c (list_append_unique): Free removed links. * utilunix.c (destroy_groups): Use g_tree_foreach() instead of obsolete g_tree_traverse(). --- src/ChangeLog | 4 ++++ src/util.c | 4 +++- src/utilunix.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 8c3b5e28d..d4cd7c0a2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2003-02-18 Pavel Roskin + * util.c (list_append_unique): Free removed links. + * utilunix.c (destroy_groups): Use g_tree_foreach() instead of + obsolete g_tree_traverse(). + * util.c (list_append_unique): Traverse the list backwards. Otherwise the list was lost when the current link was removed. diff --git a/src/util.c b/src/util.c index 489dcf1e2..31b5e2d08 100644 --- a/src/util.c +++ b/src/util.c @@ -1181,8 +1181,10 @@ list_append_unique (GList *list, char *text) while (link) { newlink = g_list_previous (link); - if (!strcmp ((char *) link->data, text)) + if (!strcmp ((char *) link->data, text)) { g_list_remove_link (list, link); + g_list_free_1 (link); + } link = newlink; } diff --git a/src/utilunix.c b/src/utilunix.c index 20368db9a..8c5ff1cc9 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -123,7 +123,7 @@ get_user_permissions (struct stat *buf) { void destroy_groups (void) { - g_tree_traverse (current_user_gid, mc_gid_destroy, G_POST_ORDER, NULL); + g_tree_foreach (current_user_gid, mc_gid_destroy, NULL); g_tree_destroy (current_user_gid); }