fix memory leak
authorThomas Thurman <tthurman@gnome.org>
Sun, 30 Aug 2009 20:32:45 +0000 (16:32 -0400)
committerThomas Thurman <tthurman@gnome.org>
Sun, 30 Aug 2009 20:32:45 +0000 (16:32 -0400)
TODO
belltower.c

diff --git a/TODO b/TODO
index 03d8ff2..35a8dc4 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
-* Fix memory leak
 * Window name on tower pick lists
 * Sharp and flat signs
 * Add my name to the credits list
index 0406988..f571278 100644 (file)
@@ -807,6 +807,20 @@ show_tower (char *primary_key)
 }
 
 static void
+free_tower_list (GSList *list)
+{
+  GSList *cursor = list;
+
+  while (cursor)
+    {
+      found_tower_free ((FoundTower*) cursor->data);
+      cursor = cursor->next;
+    }
+
+  g_slist_free (list);
+}
+
+static void
 show_towers_from_list (GSList *list)
 {
   GtkWidget *dialog;
@@ -833,7 +847,7 @@ show_towers_from_list (GSList *list)
                                     "One tower found.");
       show_tower (found->primarykey);
 
-      /* FIXME: and free the list */
+      free_tower_list (list);
       return;
     }
 
@@ -870,7 +884,7 @@ show_towers_from_list (GSList *list)
       show_tower (found->primarykey);
     }
 
-  /* FIXME: and free the list */
+  free_tower_list (list);
 }
 
 static gint strcmp_f (gconstpointer a,