@@ -38,7 +38,7 @@ GATTClass::GATTClass() :
38
38
39
39
GATTClass::~GATTClass ()
40
40
{
41
- clearAttributes ();
41
+ end ();
42
42
}
43
43
44
44
void GATTClass::begin ()
@@ -70,7 +70,22 @@ void GATTClass::begin()
70
70
71
71
void GATTClass::end ()
72
72
{
73
- _attributes.clear ();
73
+ if (_genericAccessService->release () == 0 )
74
+ delete (_genericAccessService);
75
+
76
+ if (_deviceNameCharacteristic->release () == 0 )
77
+ delete (_deviceNameCharacteristic);
78
+
79
+ if (_appearanceCharacteristic->release () == 0 )
80
+ delete (_appearanceCharacteristic);
81
+
82
+ if (_genericAttributeService->release () == 0 )
83
+ delete (_genericAttributeService);
84
+
85
+ if (_servicesChangedCharacteristic->release () == 0 )
86
+ delete (_servicesChangedCharacteristic);
87
+
88
+ clearAttributes ();
74
89
}
75
90
76
91
void GATTClass::setDeviceName (const char * deviceName)
@@ -164,7 +179,7 @@ void GATTClass::clearAttributes()
164
179
for (unsigned int i = 0 ; i < attributeCount (); i++) {
165
180
BLELocalAttribute* a = attribute (i);
166
181
167
- if (a->release () < = 0 ) {
182
+ if (a->release () = = 0 ) {
168
183
delete a;
169
184
}
170
185
}
0 commit comments