Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSystem: Don't leak on directory scan cancel #12378

Merged
merged 1 commit into from
Mar 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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