FileSystem: Don't leak on directory scan cancel

Fixes: 7587581d1f
This commit is contained in:
TellowKrinkle 2025-03-01 23:44:15 -06:00 committed by Ty
parent b6680e4aca
commit 05e19470b2
1 changed files with 6 additions and 6 deletions

View File

@ -1356,6 +1356,9 @@ static u32 TranslateWin32Attributes(u32 Win32Attributes)
static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path, const char* path, const char* pattern,
u32 flags, FileSystem::FindResultsArray* results, std::vector<std::string>& visited, ProgressCallback* cancel)
{
if (cancel && cancel->IsCancelled())
return 0;
std::string search_dir;
if (path)
{
@ -1378,9 +1381,6 @@ static u32 RecursiveFindFiles(const char* origin_path, const char* parent_path,
if (hFind == INVALID_HANDLE_VALUE)
return 0;
if (cancel && cancel->IsCancelled())
return 0;
// small speed optimization for '*' case
bool hasWildCards = false;
bool wildCardMatchAll = false;
@ -2051,6 +2051,9 @@ static_assert(sizeof(off_t) == sizeof(s64));
static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, const char* Path, const char* Pattern,
u32 Flags, FileSystem::FindResultsArray* pResults, std::vector<std::string>& visited, ProgressCallback* cancel)
{
if (cancel && cancel->IsCancelled())
return 0;
std::string tempStr;
if (Path)
{
@ -2068,9 +2071,6 @@ static u32 RecursiveFindFiles(const char* OriginPath, const char* ParentPath, co
if (!pDir)
return 0;
if (cancel && cancel->IsCancelled())
return 0;
// small speed optimization for '*' case
bool hasWildCards = false;
bool wildCardMatchAll = false;