summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-08-30 15:02:49 +0200
committerGitHub <noreply@github.com>2019-08-30 15:02:49 +0200
commit495a0a97a296f8c9921e90846590fa55f595b701 (patch)
tree7936c018323e54e56cb77012246a8e6e10ceb5f7
parent3db1d400458853bfa33c4605c819d368c11e4a57 (diff)
parentb244ab4acc85ae89dc5f64bc528559db408b890c (diff)
Merge pull request #31768 from qarmin/fix_memory_leak_in_ResourceFormatSaverBinary
Fix memory leak in ResourceFormatSaverBinary::save
-rw-r--r--core/io/resource_format_binary.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index de10fe1376..0ad2479b05 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1786,6 +1786,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
f->close();
+ memdelete(f);
return ERR_CANT_CREATE;
}
@@ -1938,10 +1939,12 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
if (f->get_error() != OK && f->get_error() != ERR_FILE_EOF) {
f->close();
+ memdelete(f);
return ERR_CANT_CREATE;
}
f->close();
+ memdelete(f);
return OK;
}