From 4180fdb664be182993f235c2142de58818cd8c7d Mon Sep 17 00:00:00 2001 From: Tobias Blum Date: Wed, 15 Apr 2020 22:44:42 +0200 Subject: [PATCH] Fixing memory leak in requestJsonApi(), kill client. --- src/request_handler.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/request_handler.h b/src/request_handler.h index 07ad5db..0084be6 100644 --- a/src/request_handler.h +++ b/src/request_handler.h @@ -42,6 +42,9 @@ boolean requestJsonApi(JsonDocument& doc, String url, String payload = "", size_ // Parse JSON data DeserializationError error = deserializeJson(doc, *client); client->stop(); + delete client; + client = NULL; + if (error) { DBG_PRINT(F("deserializeJson() failed: ")); DBG_PRINTLN(error.c_str());