mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
Fix memory leak when passing directories to -file
This commit is contained in:
parent
efa82cf38b
commit
fc6f983c13
1 changed files with 4 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue