about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-06-24 23:08:35 +0100
committerJames Booth <boothj5@gmail.com>2014-06-24 23:08:35 +0100
commit8cf7122e7a10352161450f3ca80b1b6e4738d7c1 (patch)
tree88c9c509a2096a68e4a33773a1f99d820927ff93
parent7872d8e14f0ff3259484dc6e190b940e838d151d (diff)
downloadprofani-tty-8cf7122e7a10352161450f3ca80b1b6e4738d7c1.tar.gz
Use g_list_free() when finding resource availability
-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;
 }