Skip to content

Commit 3b69c33

Browse files
authored
Merge pull request #162 from iyadahmed/master
Fix memory leaks that were reported by LeakSanitizer on Linux during …
2 parents 3cd893a + 5aca36b commit 3b69c33

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ImGuiFileDialog.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,8 @@ class FileSystemDirent : public IGFD::IFileSystem {
559559
// this func will fail
560560
pDir = opendir(vName.c_str());
561561
if (pDir != nullptr) {
562-
return true;
563562
(void)closedir(pDir);
563+
return true;
564564
}
565565
}
566566
return false;
@@ -728,7 +728,12 @@ class FileSystemDirent : public IGFD::IFileSystem {
728728
return res;
729729
}
730730
bool IsDirectory(const std::string& vFilePathName) override {
731-
return (opendir(vFilePathName.c_str()) != nullptr);
731+
DIR *pDir = opendir(vFilePathName.c_str());
732+
if (pDir) {
733+
(void)closedir(pDir);
734+
return true;
735+
}
736+
return false;
732737
}
733738
};
734739
#define FILE_SYSTEM_OVERRIDE FileSystemDirent

0 commit comments

Comments
 (0)