fix memory leak
[belltower] / belltower.c
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,