summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 5a680c776..997694240 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -251,6 +251,14 @@ static gboolean ask_save_changes()
return quit;
}
+static void dive_trip_unref(gpointer data, gpointer user_data)
+{
+ dive_trip_t *dive_trip = (dive_trip_t *)data;
+ if (dive_trip->location)
+ free(dive_trip->location);
+ free(data);
+}
+
static void file_close(GtkWidget *w, gpointer data)
{
int i;
@@ -271,7 +279,7 @@ static void file_close(GtkWidget *w, gpointer data)
mark_divelist_changed(FALSE);
/* inlined version of g_list_free_full(dive_trip_list, free); */
- g_list_foreach(dive_trip_list, (GFunc)free, NULL);
+ g_list_foreach(dive_trip_list, (GFunc)dive_trip_unref, NULL);
g_list_free(dive_trip_list);
dive_trip_list = NULL;