Unverified Commit 96a2e925 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Fix leak in HTTPSClient (#2256)

Fixes #2254

The faked certificate was allocated but not deleted in certain cases.  Make sure
to clean up in the destructor.
parent 8cb88075
......@@ -179,7 +179,11 @@ typedef std::vector<Cookie> CookieJar;
class HTTPClient {
public:
HTTPClient() = default;
~HTTPClient() = default;
~HTTPClient() {
if (_clientMade) {
delete _clientMade;
}
}
HTTPClient(HTTPClient&&) = default;
HTTPClient& operator=(HTTPClient&&) = default;
......
......@@ -123,6 +123,10 @@ WiFiClientSecureCtx::~WiFiClientSecureCtx() {
_client->unref();
_client = nullptr;
}
if (_esp32_ta) {
delete _esp32_ta;
}
_cipher_list = nullptr; // std::shared will free if last reference
_freeSSL();
stack_thunk_del_ref();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment