summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorKlesomik <Klesomiks@gmail.com>2019-08-26 20:48:10 +0300
committerKlesomik <Klesomiks@gmail.com>2019-08-26 20:48:10 +0300
commitd3c879fe1bbba83aa7c365441422b0dcb22b82f4 (patch)
treeab278892dbadd5573d9f93f046c5a6a005b11d07 /editor
parent360d0bb6a3109bc518f13f539d39960425af67d3 (diff)
Memory leak fixed
In some functions in editor/find_in_files.cpp was detected a memory leak DirAccess* and FileAccess* were replaced by DirAccessRef and FileAccessRef DirAccessRef and FileAccessRef are just wrappers for DirAccess* and FileAccess* Fixes for issue #31659
Diffstat (limited to 'editor')
-rw-r--r--editor/find_in_files.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index cc2efb92ae..def22d07de 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -221,8 +221,8 @@ float FindInFiles::get_progress() const {
void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
- DirAccess *dir = DirAccess::open(path);
- if (dir == NULL) {
+ DirAccessRef dir = DirAccess::open(path);
+ if (!dir) {
print_verbose("Cannot open directory! " + path);
return;
}
@@ -253,8 +253,8 @@ void FindInFiles::_scan_dir(String path, PoolStringArray &out_folders) {
void FindInFiles::_scan_file(String fpath) {
- FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
- if (f == NULL) {
+ FileAccessRef f = FileAccess::open(fpath, FileAccess::READ);
+ if (!f) {
print_verbose(String("Cannot open file ") + fpath);
return;
}