1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05: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 // xa
// dnd // dnd
GList *resources = g_hash_table_get_values(contact->available_resources); GList *resources = g_hash_table_get_values(contact->available_resources);
Resource *current = resources->data; GList *curr = resources;
Resource *current = curr->data;
Resource *highest = current; Resource *highest = current;
resources = g_list_next(resources); curr = g_list_next(curr);
while (resources != NULL) { while (curr != NULL) {
current = resources->data; current = curr->data;
// priority is same as current highest, choose presence // priority is same as current highest, choose presence
if (current->priority == highest->priority) { if (current->priority == highest->priority) {
@ -238,9 +239,9 @@ _get_most_available_resource(PContact contact)
highest = current; highest = current;
} }
resources = g_list_next(resources); curr = g_list_next(curr);
} }
free(resources); g_list_free(resources);
return highest; return highest;
} }