diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-09-15 20:51:06 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-09-17 21:03:30 -0400 |
commit | 7148dea82795b81311c46dfb11d09c8fa2b13452 (patch) | |
tree | 5635ac7d83b99b8c774af655c5fdfa2a443ef900 /macos.c | |
parent | fa2f1b6eb06e65e6426cc3a488c6cb5c960e7d49 (diff) | |
download | subsurface-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 'macos.c')
-rw-r--r-- | macos.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -89,7 +89,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; |