Skip to content
Permalink
Browse files

Fix some memory leak.

  • Loading branch information
denisfa authored and rkitover committed Jul 4, 2019
1 parent 8ea607e commit 030740ee345ccaa638c1cc4d4013936128fa2adf
Showing with 6 additions and 6 deletions.
  1. +5 −5 src/common/ConfigManager.cpp
  2. +1 −1 src/sdl/SDL.cpp
@@ -663,12 +663,12 @@ const char* FindConfigFile(const char *name)

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

if (homeDir) {
sprintf(path, "%s%c%s", homeDir, FILE_SEP, name);
if (fullDir) {
sprintf(path, "%s%c%s", fullDir, FILE_SEP, name);
if (FileExists(path))
{
return path;
@@ -369,7 +369,7 @@ FILE* sdlFindFile(const char* name)
return f;
}

if (homeDir) {
if (homeDataDir) {
fprintf(stdout, "Searching home directory: %s\n", homeDataDir);
sprintf(path, "%s%c%s", homeDataDir, FILE_SEP, name);
f = fopen(path, "r");

0 comments on commit 030740e

Please sign in to comment.
You can’t perform that action at this time.