mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 14:25:37 +00:00
Merge pull request #564 from lioncash/leak
file_system: Prevent resource leaks in DeleteDirectory()
This commit is contained in:
commit
84d4423719
|
@ -1027,14 +1027,20 @@ bool FileSystem::DeleteDirectory(const char* Path, bool Recursive)
|
|||
{
|
||||
// recurse into that
|
||||
if (!DeleteDirectory(fileName, true))
|
||||
{
|
||||
FindClose(hFind);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// found a file, so delete it
|
||||
if (!DeleteFileA(fileName))
|
||||
{
|
||||
FindClose(hFind);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} while (FindNextFileA(hFind, &findData));
|
||||
FindClose(hFind);
|
||||
|
||||
|
|
Loading…
Reference in a new issue