From 7148dea82795b81311c46dfb11d09c8fa2b13452 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 15 Sep 2012 20:51:06 -0700 Subject: Once again improve existing filename handling Several potential problems. - we could end up dereferencing exiting_filename when it was NULL - we could free the default_filename by mistake - subsurface_default_filename always needs to return a copy of it - closing the existing file before opening a new one repopulated the existing_filename with the default filename - preventing the opened file to become the new existing filename Also, make existing filename a const char * and make file_open have the same sensible default folder behavior as the other file related functions. Signed-off-by: Dirk Hohndel --- linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux.c') diff --git a/linux.c b/linux.c index 8d9f6f8ce..47a00a059 100644 --- a/linux.c +++ b/linux.c @@ -69,7 +69,7 @@ const char *subsurface_icon_name() const char *subsurface_default_filename() { if (default_filename) { - return default_filename; + return strdup(default_filename); } else { const char *home, *user; char *buffer; -- cgit v1.2.3-70-g09d2