fix mem error for config global `homeDir`

Fix `homeDir` `ConfigManager` global pointing to freed memory.

Thanks to @FredericHamel for catching this.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-06-23 20:08:23 +00:00
parent ccc91fa04b
commit 684b1bb7aa
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 1 additions and 1 deletions

View File

@ -663,7 +663,7 @@ const char* FindConfigFile(const char *name)
struct stat s;
std::string homeDirTmp = get_xdg_user_config_home() + DOT_DIR;
homeDir = (char *)homeDirTmp.c_str();
homeDir = strdup(homeDirTmp.c_str());
if (stat(homeDir, &s) == -1 || !S_ISDIR(s.st_mode))
mkdir(homeDir, 0755);