diff options
author | James Booth <boothj5@gmail.com> | 2014-11-13 01:01:41 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-11-13 01:01:41 +0000 |
commit | 0a7c16747b45c69b9c6e4aa5b384a84197a495f7 (patch) | |
tree | 4889403bef1d32ca9a5368db767d0755ff273305 /src/ui | |
parent | ada6f5a8b6c9e62728ff1f9a3580a11b11016625 (diff) | |
download | profani-tty-0a7c16747b45c69b9c6e4aa5b384a84197a495f7.tar.gz |
Fixed freeing lists
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/core.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/ui/core.c b/src/ui/core.c index 7fb0a01c..906f4a4b 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -2835,19 +2835,9 @@ _ui_roster_contact(PContact contact) if (prefs_get_boolean(PREF_ROSTER_RESOURCE)) { GList *resources = p_contact_get_available_resources(contact); - GList *ordered_resources = NULL; - - // sort in order of availabiltiy - while (resources != NULL) { - Resource *resource = resources->data; - ordered_resources = g_list_insert_sorted(ordered_resources, resource, (GCompareFunc)resource_compare_availability); - resources = g_list_next(resources); - } - - g_list_free(resources); - - while (ordered_resources) { - Resource *resource = ordered_resources->data; + GList *curr_resource = resources; + while (curr_resource) { + Resource *resource = curr_resource->data; const char *resource_presence = string_from_resource_presence(resource->presence); int resource_presence_colour = win_presence_colour(resource_presence); wattron(window->subwin, resource_presence_colour); @@ -2859,9 +2849,9 @@ _ui_roster_contact(PContact contact) wattroff(window->subwin, resource_presence_colour); - ordered_resources = g_list_next(ordered_resources); + curr_resource = g_list_next(curr_resource); } - g_list_free(ordered_resources); + g_list_free(resources); } } } @@ -2951,6 +2941,7 @@ _ui_roster(void) _ui_roster_contacts_by_group(curr_group->data); curr_group = g_slist_next(curr_group); } + g_slist_free_full(groups, free); _ui_roster_contacts_by_no_group(); } else { GSList *contacts = roster_get_contacts(); |