summaryrefslogtreecommitdiffstats
path: root/windows.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-15 20:51:06 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-17 21:03:30 -0400
commit7148dea82795b81311c46dfb11d09c8fa2b13452 (patch)
tree5635ac7d83b99b8c774af655c5fdfa2a443ef900 /windows.c
parentfa2f1b6eb06e65e6426cc3a488c6cb5c960e7d49 (diff)
downloadsubsurface-7148dea82795b81311c46dfb11d09c8fa2b13452.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'windows.c')
-rw-r--r--windows.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/windows.c b/windows.c
index 87bcaf6bd..b6e10bb71 100644
--- a/windows.c
+++ b/windows.c
@@ -98,7 +98,7 @@ const char *subsurface_icon_name()
const char *subsurface_default_filename()
{
if (default_filename) {
- return default_filename;
+ return strdup(default_filename);
} else {
char datapath[MAX_PATH];
const char *user;