about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/contact.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/contact.c b/src/contact.c
index c57d1902..f2257b9a 100644
--- a/src/contact.c
+++ b/src/contact.c
@@ -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;
 }