]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Correctly free the GSList in file_open
authorDirk Hohndel <dirk@hohndel.org>
Tue, 3 Jan 2012 04:13:45 +0000 (20:13 -0800)
committerDirk Hohndel <dirk@hohndel.org>
Tue, 3 Jan 2012 04:13:45 +0000 (20:13 -0800)
Passing a value that is known to be NULL to g_slist_free seems like the
wrong approach...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
gtk-gui.c

index f17120319610c1de7b508a0391ca5158a19d4ac3..ddae481b16aa9e353ffc41fd849144c02ef263f4 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -106,9 +106,9 @@ static void file_open(GtkWidget *w, gpointer data)
        gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
 
        if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
-               GSList *filenames;
+               GSList *filenames, *fn_glist;
                char *filename;
-               filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
+               filenames = fn_glist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
                
                GError *error = NULL;
                while(filenames != NULL) {
@@ -124,7 +124,7 @@ static void file_open(GtkWidget *w, gpointer data)
                        g_free(filename);
                        filenames = g_slist_next(filenames);
                }
-               g_slist_free(filenames);
+               g_slist_free(fn_glist);
                report_dives(FALSE);
        }
        gtk_widget_destroy(dialog);