From 0ac9ed0b6b97885a99eb1dc3c9e5e12458bc2055 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 24 Nov 2013 15:21:38 +0000 Subject: (svn r26089) -Fix: a number of minor memory leaks --- src/fileio.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/fileio.cpp') 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 -- cgit v1.2.3-54-g00ecf