From 7823552d9ea3beddee06b10cb161f2d6f5f66739 Mon Sep 17 00:00:00 2001 From: qarmin Date: Fri, 30 Aug 2019 13:46:05 +0200 Subject: [PATCH] Fix memory leak in ResourceFormatSaverBinary::save (cherry picked from commit b244ab4acc85ae89dc5f64bc528559db408b890c) --- core/io/resource_format_binary.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 42070cd1328..bf290b16317 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1801,6 +1801,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; } @@ -1953,10 +1954,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; }