From 14a58560e185823af6a9a99700907b4de7b5fba8 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Tue, 14 Jan 2020 15:06:53 +0100 Subject: [PATCH] Properly close files served by debug HTTP server. --- platform/javascript/export/export.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 53983f75566..9b93d4f1401 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -119,7 +119,10 @@ public: s += "\r\n"; CharString cs = s.utf8(); Error err = connection->put_data((const uint8_t *)cs.get_data(), cs.size() - 1); - ERR_FAIL_COND(err != OK); + if (err != OK) { + memdelete(f); + ERR_FAIL(); + } while (true) { uint8_t bytes[4096]; @@ -128,8 +131,12 @@ public: break; } err = connection->put_data(bytes, read); - ERR_FAIL_COND(err != OK); + if (err != OK) { + memdelete(f); + ERR_FAIL(); + } } + memdelete(f); } void poll() {