diff options
author | rubidium <rubidium@openttd.org> | 2013-11-24 15:21:38 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-11-24 15:21:38 +0000 |
commit | 0ac9ed0b6b97885a99eb1dc3c9e5e12458bc2055 (patch) | |
tree | 257edf28dc8862ad6bd78bb65509fd133035e3dd /src/fileio.cpp | |
parent | 2fc10b7e040f9901ba46313eed5ffd2166fedabd (diff) | |
download | openttd-0ac9ed0b6b97885a99eb1dc3c9e5e12458bc2055.tar.xz |
(svn r26089) -Fix: a number of minor memory leaks
Diffstat (limited to 'src/fileio.cpp')
-rw-r--r-- | src/fileio.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp index 3bc5cf768..8ce1d72a6 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -1083,8 +1083,11 @@ void DetermineBasePaths(const char *exe) { char tmp[MAX_PATH]; #if defined(WITH_XDG_BASEDIR) && defined(WITH_PERSONAL_DIR) - snprintf(tmp, MAX_PATH, "%s" PATHSEP "%s", xdgDataHome(NULL), + const char *xdg_data_home = xdgDataHome(NULL); + snprintf(tmp, MAX_PATH, "%s" PATHSEP "%s", xdg_data_home, PERSONAL_DIR[0] == '.' ? &PERSONAL_DIR[1] : PERSONAL_DIR); + free(xdg_data_home); + AppendPathSeparator(tmp, MAX_PATH); _searchpaths[SP_PERSONAL_DIR_XDG] = strdup(tmp); #endif @@ -1174,8 +1177,12 @@ void DeterminePaths(const char *exe) #if defined(WITH_XDG_BASEDIR) && defined(WITH_PERSONAL_DIR) char config_home[MAX_PATH]; - snprintf(config_home, MAX_PATH, "%s" PATHSEP "%s", xdgConfigHome(NULL), + + const char *xdg_config_home = xdgConfigHome(NULL); + snprintf(config_home, MAX_PATH, "%s" PATHSEP "%s", xdg_config_home, PERSONAL_DIR[0] == '.' ? &PERSONAL_DIR[1] : PERSONAL_DIR); + free(xdg_config_home); + AppendPathSeparator(config_home, MAX_PATH); #endif |