From 768f9422bc3b1349729b8a50feb8c0797003aee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 10 Mar 2022 15:27:09 +0100 Subject: Convert uses of `DirAccess *` to `DirAccessRef` to prevent memleaks `DirAccess *` needs to be deleted manually, and this is often forgotten especially when doing early returns with `ERR_FAIL_COND`. `DirAccessRef` is deleted automatically when it goes out of scope. Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com> --- scene/resources/resource_format_text.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'scene/resources/resource_format_text.cpp') diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index d9ac967699..fd6f018651 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -908,10 +908,9 @@ Error ResourceLoaderText::rename_dependencies(FileAccess *p_f, const String &p_p return ERR_CANT_CREATE; } - DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); da->remove(p_path); da->rename(p_path + ".depren", p_path); - memdelete(da); return OK; } -- cgit v1.2.3