1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-10-13 20:13:38 -04:00

Use g_list_free() when finding resource availability

This commit is contained in:
James Booth 2014-06-24 23:08:35 +01:00
parent 7872d8e14f
commit 8cf7122e7a

View File

@ -223,11 +223,12 @@ _get_most_available_resource(PContact contact)
// xa
// dnd
GList *resources = g_hash_table_get_values(contact->available_resources);
Resource *current = resources->data;
GList *curr = resources;
Resource *current = curr->data;
Resource *highest = current;
resources = g_list_next(resources);
while (resources != NULL) {
current = resources->data;
curr = g_list_next(curr);
while (curr != NULL) {
current = curr->data;
// priority is same as current highest, choose presence
if (current->priority == highest->priority) {
@ -238,9 +239,9 @@ _get_most_available_resource(PContact contact)
highest = current;
}
resources = g_list_next(resources);
curr = g_list_next(curr);
}
free(resources);
g_list_free(resources);
return highest;
}