]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Fix uninitialized pointer crash for "Save As"
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 18 Aug 2012 16:48:15 +0000 (09:48 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 18 Aug 2012 16:48:15 +0000 (09:48 -0700)
The "filename" variable was only initialized when the user accepted the
name, so cancelling the file save would randomly use an uninitialized
pointer.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
gtk-gui.c

index 5bc46d2190248be4c7a7c68b121c2766258b9f0b..18c19c79f1cd377d39ad3f846346ed49ef82b9d0 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -173,7 +173,7 @@ static void file_open(GtkWidget *w, gpointer data)
 static void file_save_as(GtkWidget *w, gpointer data)
 {
        GtkWidget *dialog;
-       char *filename;
+       char *filename = NULL;
        dialog = gtk_file_chooser_dialog_new("Save File As",
                GTK_WINDOW(main_window),
                GTK_FILE_CHOOSER_ACTION_SAVE,