Fix memory leak when passing directories to -file

This commit is contained in:
Randy Heit 2015-04-03 21:50:08 -05:00
parent efa82cf38b
commit fc6f983c13
1 changed files with 4 additions and 1 deletions

View File

@ -111,9 +111,12 @@ FDirectory::FDirectory(const char * directory)
#ifdef _WIN32 #ifdef _WIN32
directory = _fullpath(NULL, directory, _MAX_PATH); directory = _fullpath(NULL, directory, _MAX_PATH);
#else #else
// Todo for Linux: Resolve the path befire using it // Todo for Linux: Resolve the path before using it
#endif #endif
dirname = directory; dirname = directory;
#ifdef _WIN32
free((void *)directory);
#endif
dirname.ReplaceChars('\\', '/'); dirname.ReplaceChars('\\', '/');
if (dirname[dirname.Len()-1] != '/') dirname += '/'; if (dirname[dirname.Len()-1] != '/') dirname += '/';
Filename = copystring(dirname); Filename = copystring(dirname);