summaryrefslogtreecommitdiffstats
path: root/platform/osx/export/codesign.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-03-10 15:27:09 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-03-11 09:13:11 +0100
commit768f9422bc3b1349729b8a50feb8c0797003aee9 (patch)
treeccc2863deb916a604b39cf67f897b32edcdfc4da /platform/osx/export/codesign.cpp
parent259114e9e0d5bb01d023ad978e06ed14ca785b1d (diff)
downloadredot-engine-768f9422bc3b1349729b8a50feb8c0797003aee9.tar.gz
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>
Diffstat (limited to 'platform/osx/export/codesign.cpp')
-rw-r--r--platform/osx/export/codesign.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/osx/export/codesign.cpp b/platform/osx/export/codesign.cpp
index 1a2ad2bee6..b609a21c44 100644
--- a/platform/osx/export/codesign.cpp
+++ b/platform/osx/export/codesign.cpp
@@ -1208,7 +1208,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const
String id;
String main_exe = p_exe_path;
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!da) {
r_error_msg = TTR("Can't get filesystem access.");
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "CodeSign: Can't get filesystem access.");
@@ -1522,7 +1522,7 @@ Error CodeSign::_codesign_file(bool p_use_hardened_runtime, bool p_force, const
}
Error CodeSign::codesign(bool p_use_hardened_runtime, bool p_force, const String &p_path, const String &p_ent_path, String &r_error_msg) {
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (!da) {
r_error_msg = TTR("Can't get filesystem access.");
ERR_FAIL_V_MSG(ERR_CANT_CREATE, "CodeSign: Can't get filesystem access.");