mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 05:00:55 +01:00
Fix memory leak when services changed.
This commit is contained in:
parent
e3ee082dd7
commit
6b858a0efd
1 changed files with 6 additions and 0 deletions
|
@ -113,6 +113,12 @@ bool NimBLEService::start() {
|
||||||
|
|
||||||
// Rebuild the service definition if the server attributes have changed.
|
// Rebuild the service definition if the server attributes have changed.
|
||||||
if(getServer()->m_svcChanged && m_pSvcDef != nullptr) {
|
if(getServer()->m_svcChanged && m_pSvcDef != nullptr) {
|
||||||
|
if(m_pSvcDef[0].characteristics) {
|
||||||
|
if(m_pSvcDef[0].characteristics[0].descriptors) {
|
||||||
|
delete(m_pSvcDef[0].characteristics[0].descriptors);
|
||||||
|
}
|
||||||
|
delete(m_pSvcDef[0].characteristics);
|
||||||
|
}
|
||||||
delete(m_pSvcDef);
|
delete(m_pSvcDef);
|
||||||
m_pSvcDef = nullptr;
|
m_pSvcDef = nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue