8000 Fix BTserial memory leaks (#1801) · lebinlv/arduino-esp32@a0f0bd9 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a0f0bd9

Browse files
copercinime-no-dev
authored andcommitted
Fix BTserial memory leaks (espressif#1801)
- Delete queue at end - Close BT connection before end - DeInit SPP
1 parent 80c110e commit a0f0bd9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ static bool _init_bt(const char *deviceName)
152152
static bool _stop_bt()
153153
{
154154
if (btStarted()){
155+
if(_spp_client)
156+
esp_spp_disconnect(_spp_client);
157+
esp_spp_deinit();
155158
esp_bluedroid_disable();
156159
esp_bluedroid_deinit();
157160
btStop();
@@ -172,6 +175,7 @@ BluetoothSerial::BluetoothSerial()
172175
BluetoothSerial::~BluetoothSerial(void)
173176
{
174177
_stop_bt();
178+
vQueueDelete(_spp_queue);
175179
}
176180

177181
bool BluetoothSerial::begin(String localName)
@@ -262,6 +266,7 @@ void BluetoothSerial::flush()
262266
void BluetoothSerial::end()
263267
{
264268
_stop_bt();
269+
vQueueDelete(_spp_queue);
265270
}
266271

267272
#endif

0 commit comments

Comments
 (0)
0