From be0c9d333f3e537ba3d9bca08b5d5fa2e2d2d846 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Thu, 21 May 2009 08:02:38 +0000 Subject: [PATCH] Handle when no disk is inserted, fix memory leak --- src/gui-sdl/gui-sdl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui-sdl/gui-sdl.c b/src/gui-sdl/gui-sdl.c index c7c151e..b0c8e82 100644 --- a/src/gui-sdl/gui-sdl.c +++ b/src/gui-sdl/gui-sdl.c @@ -172,7 +172,15 @@ static void insert_floppy(int which) const char *name = menu_select_file(prefs_get_attr("floppy_path")); if (name != NULL) - strcpy (changed_prefs.df[which], name); + { + if (strcmp(name, "None") == 0) + changed_prefs.df[which][0] = '\0'; + else + strcpy (changed_prefs.df[which], name); + free(name); + } + else + changed_prefs.df[which][0] = '\0'; } static void memory_options(void)