Skip to content

Commit

Permalink
FileSystem: Don't leak on directory scan cancel
Browse files Browse the repository at this point in the history
Fixes: 7587581
  • Loading branch information
TellowKrinkle authored and F0bes committed Mar 2, 2025
1 parent b6680e4 commit 05e1947
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions common/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down

0 comments on commit 05e1947

Please sign in to comment.