about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-02-09 19:50:41 +0000
committerJames Booth <boothj5@gmail.com>2015-02-09 19:50:41 +0000
commit268c33e1c6e7ee5a4a26299311289933c66460e2 (patch)
tree4989dfbdefc1363e4af21bbd94a6afdf2b73be7e /src
parent44c5b34a710f7c90b455ec92146530f95e25ab90 (diff)
downloadprofani-tty-268c33e1c6e7ee5a4a26299311289933c66460e2.tar.gz
Free resource lists on /account command
Diffstat (limited to 'src')
-rw-r--r--src/ui/console.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index cdf5d1b8..2c37c40c 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -717,20 +717,24 @@ cons_show_account(ProfAccount *account)
         GList *resources = jabber_get_available_resources();
         GList *ordered_resources = NULL;
 
-        if (resources != NULL) {
+        GList *curr = resources;
+        if (curr != NULL) {
             win_save_println(console, "Resources:");
 
             // sort in order of availabiltiy
-            while (resources != NULL) {
-                Resource *resource = resources->data;
+            while (curr != NULL) {
+                Resource *resource = curr->data;
                 ordered_resources = g_list_insert_sorted(ordered_resources,
                     resource, (GCompareFunc)resource_compare_availability);
-                resources = g_list_next(resources);
+                curr = g_list_next(curr);
             }
         }
 
-        while (ordered_resources != NULL) {
-            Resource *resource = ordered_resources->data;
+        g_list_free(resources);
+
+        curr = ordered_resources;
+        while (curr != NULL) {
+            Resource *resource = curr->data;
             const char *resource_presence = string_from_resource_presence(resource->presence);
             theme_item_t presence_colour = theme_main_presence_attrs(resource_presence);
             win_save_vprint(console, '-', NULL, NO_EOL, presence_colour, "", "  %s (%d), %s", resource->name, resource->priority, resource_presence);
@@ -785,8 +789,9 @@ cons_show_account(ProfAccount *account)
                 caps_destroy(caps);
             }
 
-            ordered_resources = g_list_next(ordered_resources);
+            curr = g_list_next(curr);
         }
+        g_list_free(ordered_resources);
     }
 
     cons_alert();
3' href='#n203'>203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259