summaryrefslogtreecommitdiff
path: root/platform/javascript/api
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/javascript/api
parent259114e9e0d5bb01d023ad978e06ed14ca785b1d (diff)
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/javascript/api')
-rw-r--r--platform/javascript/api/javascript_tools_editor_plugin.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/platform/javascript/api/javascript_tools_editor_plugin.cpp b/platform/javascript/api/javascript_tools_editor_plugin.cpp
index bea54ae1cb..0442a1eaeb 100644
--- a/platform/javascript/api/javascript_tools_editor_plugin.cpp
+++ b/platform/javascript/api/javascript_tools_editor_plugin.cpp
@@ -124,7 +124,7 @@ void JavaScriptToolsEditorPlugin::_zip_file(String p_path, String p_base_path, z
}
void JavaScriptToolsEditorPlugin::_zip_recursive(String p_path, String p_base_path, zipFile p_zip) {
- DirAccess *dir = DirAccess::open(p_path);
+ DirAccessRef dir = DirAccess::open(p_path);
if (!dir) {
WARN_PRINT("Unable to open directory for zipping: " + p_path);
return;