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
This commit is contained in:
Klesomik 2019-08-26 20:48:10 +03:00
parent 360d0bb6a3
commit d3c879fe1b

View file

@ -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;
}