From 3584e279483847d984d2a6860a00571c0d7d664c Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 16 Feb 2020 13:22:25 +0800 Subject: [PATCH] Fixes memory leak when loading StreamTexture --- scene/resources/texture.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 4ddceed58ec..ff9c786b4c0 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -588,6 +588,8 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &tw_ image = load_image_from_file(f, p_size_limit); + memdelete(f); + if (image.is_null() || image->empty()) { return ERR_CANT_OPEN; }