fix(nimble): Fixed memory leak when dynamic services are disabled

This commit is contained in:
Rahul Tank
2026-02-27 11:14:20 +05:30
parent 7526bde3a9
commit 2c0e41e3b5
+9
View File
@@ -1721,6 +1721,9 @@ ble_gatts_free_svc_defs(void)
static void
ble_gatts_free_mem(void)
{
#if !MYNEWT_VAL(BLE_DYNAMIC_SERVICE)
int rc;
#endif
#if MYNEWT_VAL(BLE_DYNAMIC_SERVICE)
struct ble_gatts_svc_entry *entry;
struct ble_gatts_clt_cfg *clt_cfg;
@@ -1732,6 +1735,12 @@ ble_gatts_free_mem(void)
ble_gatts_clt_cfg_free(clt_cfg);
}
}
#else
if (ble_gatts_clt_cfgs != NULL) {
rc = os_memblock_put(&ble_gatts_clt_cfg_pool, ble_gatts_clt_cfgs);
BLE_HS_DBG_ASSERT_EVAL(rc == 0);
ble_gatts_clt_cfgs = NULL;
}
#endif
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
if (ble_hs_max_client_configs > 0) {