Skip to content

Commit d873588

Browse files
author
brentru
committed
add destructor for airlift mqttclient and httpclient
1 parent 6a4519f commit d873588

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/AdafruitIO_AIRLIFT.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#define ESP32_GPIO0 -1 // Not connected
3030
#endif
3131

32-
// br: try to emulate everything in the header to avoid wifinina-wifi101 conflicts
3332
class AdafruitIO_AIRLIFT : public AdafruitIO {
3433

3534
public:
@@ -43,7 +42,17 @@ class AdafruitIO_AIRLIFT : public AdafruitIO {
4342
_http = new HttpClient(*_http_client, _host, _http_port);
4443
}
4544

46-
//~AdafruitIO_AIRLIFT();
45+
~AdafruitIO_AIRLIFT()
46+
{
47+
if (_mqtt_client)
48+
delete _http_client;
49+
if (_http_client)
50+
delete _mqtt_client;
51+
if (_mqtt)
52+
delete _mqtt;
53+
if (_http)
54+
delete _http;
55+
}
4756

4857
aio_status_t networkStatus()
4958
{

0 commit comments

Comments
 (0)