From 07941178f0d4fd0b48a7817b32ec6e90fe69728d Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Mon, 20 Jan 2020 12:15:57 +0800 Subject: [PATCH] Fixes leak when pck_start multiple times --- core/io/pck_packer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/io/pck_packer.cpp b/core/io/pck_packer.cpp index 8bc73103e98..fb83f0ac909 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) + ".");