summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-01-20 07:00:11 +0100
committerGitHub <noreply@github.com>2020-01-20 07:00:11 +0100
commit11260fb87f393e56692e6ba063609b5993d8d5f6 (patch)
treed96eed1388a38f19fba105dee192c320bcfd2691 /core
parent2e8d4b681ee7af24f87128d8824a2be659e88b0a (diff)
parent07941178f0d4fd0b48a7817b32ec6e90fe69728d (diff)
downloadredot-engine-11260fb87f393e56692e6ba063609b5993d8d5f6.tar.gz
Merge pull request #35345 from timothyqiu/pck-packer-leak
Fixes leak when calling PCKPacker::pck_start multiple times
Diffstat (limited to 'core')
-rw-r--r--core/io/pck_packer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp
index 8bc73103e9..fb83f0ac90 100644
--- a/core/io/pck_packer.cpp
+++ b/core/io/pck_packer.cpp
@@ -63,6 +63,10 @@ void PCKPacker::_bind_methods() {
Error PCKPacker::pck_start(const String &p_file, int p_alignment) {
+ if (file != NULL) {
+ memdelete(file);
+ }
+
file = FileAccess::open(p_file, FileAccess::WRITE);
ERR_FAIL_COND_V_MSG(!file, ERR_CANT_CREATE, "Can't open file to write: " + String(p_file) + ".");