Skip to content

Commit 2b72c94

Browse files
committed
Don't double-free characteristics
1 parent f24ba26 commit 2b72c94

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/utility/GATT.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ void GATTClass::begin()
7070

7171
void GATTClass::end()
7272
{
73-
if (_genericAccessService->release() <= 0)
73+
if (_genericAccessService->release() == 0)
7474
delete(_genericAccessService);
7575

76-
if (_deviceNameCharacteristic->release() <= 0)
76+
if (_deviceNameCharacteristic->release() == 0)
7777
delete(_deviceNameCharacteristic);
7878

79-
if (_appearanceCharacteristic->release() <= 0)
79+
if (_appearanceCharacteristic->release() == 0)
8080
delete(_appearanceCharacteristic);
8181

82-
if (_genericAttributeService->release() <= 0)
82+
if (_genericAttributeService->release() == 0)
8383
delete(_genericAttributeService);
8484

85-
if (_servicesChangedCharacteristic->release() <= 0)
85+
if (_servicesChangedCharacteristic->release() == 0)
8686
delete(_servicesChangedCharacteristic);
8787

8888
clearAttributes();

0 commit comments

Comments
 (0)