Skip to content

Commit cc5622c

Browse files
committed
add destructor to feed class
1 parent 481cf14 commit cc5622c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

AdafruitIO_Feed.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@ AdafruitIO_Feed::AdafruitIO_Feed(AdafruitIO *io, const __FlashStringHelper *n)
1717
_pub = 0;
1818
}
1919

20+
AdafruitIO_Feed::~AdafruitIO_Feed()
21+
{
22+
if(_sub)
23+
delete _sub;
24+
25+
if(_pub)
26+
delete _pub;
27+
28+
if(_data)
29+
delete _data;
30+
31+
if(_topic)
32+
free(_topic);
33+
}
34+
2035
void AdafruitIO_Feed::onMessage(AdafruitIODataCallbackType cb)
2136
{
2237
if(! _sub)
@@ -150,6 +165,7 @@ void AdafruitIO_Feed::_init()
150165
_topic = 0;
151166
_sub = 0;
152167
_pub = 0;
168+
_data = 0;
153169

154170
}
155171

AdafruitIO_Feed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class AdafruitIO_Feed {
1414
public:
1515
AdafruitIO_Feed(AdafruitIO *io, const char *name);
1616
AdafruitIO_Feed(AdafruitIO *io, const __FlashStringHelper *name);
17+
~AdafruitIO_Feed();
1718

1819
void onMessage(AdafruitIODataCallbackType cb);
1920

0 commit comments

Comments
 (0)