summaryrefslogtreecommitdiffstats
path: root/core/linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/linux.c')
-rw-r--r--core/linux.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/linux.c b/core/linux.c
index da96ecb49..2f8d9d832 100644
--- a/core/linux.c
+++ b/core/linux.c
@@ -83,18 +83,17 @@ const char *system_default_directory(void)
const char *system_default_filename(void)
{
- static char *filename = NULL;
- if (!filename) {
+ static const char *path = NULL;
+ if (!path) {
const char *user = getenv("LOGNAME");
if (same_string(user, ""))
user = "username";
- filename = calloc(strlen(user) + 5, 1);
+ char *filename = calloc(strlen(user) + 5, 1);
strcat(filename, user);
strcat(filename, ".xml");
- }
- static const char *path = NULL;
- if (!path)
path = system_default_path_append(filename);
+ free(filename);
+ }
return path;
}