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:
parent
ccc91fa04b
commit
684b1bb7aa
|
@ -663,7 +663,7 @@ const char* FindConfigFile(const char *name)
|
||||||
|
|
||||||
struct stat s;
|
struct stat s;
|
||||||
std::string homeDirTmp = get_xdg_user_config_home() + DOT_DIR;
|
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))
|
if (stat(homeDir, &s) == -1 || !S_ISDIR(s.st_mode))
|
||||||
mkdir(homeDir, 0755);
|
mkdir(homeDir, 0755);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue