* util.c (list_append_unique): Free removed links.

* utilunix.c (destroy_groups): Use g_tree_foreach() instead of
obsolete g_tree_traverse().
This commit is contained in:
Pavel Roskin 2003-02-19 00:42:04 +00:00
parent cb1438913a
commit 30aeb24388
3 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2003-02-18 Pavel Roskin <proski@gnu.org>
* 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.

View File

@ -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;
}

View File

@ -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);
}