diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-01-20 12:15:57 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-01-20 12:16:37 +0800 |
commit | 07941178f0d4fd0b48a7817b32ec6e90fe69728d (patch) | |
tree | 026c9f0033e7eca20d5d9ff779dc57a9812b3fc8 /core/io | |
parent | adb6734b491091663d9159efe6e5a5fa9ff5202f (diff) |
Fixes leak when pck_start multiple times
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/pck_packer.cpp | 4 |
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) + "."); |