mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'fix/ble_mesh_github_pr_14140_v5.2' into 'release/v5.2'
fix(ble-mesh): don't use dangling pointer in nimble gatt service (v5.2) See merge request espressif/esp-idf!32613
This commit is contained in:
@ -1309,7 +1309,6 @@ int bt_mesh_gatts_service_stop(struct bt_mesh_gatt_service *svc)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
uint16_t handle;
|
uint16_t handle;
|
||||||
const ble_uuid_t *uuid;
|
|
||||||
|
|
||||||
if (!svc) {
|
if (!svc) {
|
||||||
BT_ERR("%s, Invalid parameter", __func__);
|
BT_ERR("%s, Invalid parameter", __func__);
|
||||||
@ -1317,12 +1316,11 @@ int bt_mesh_gatts_service_stop(struct bt_mesh_gatt_service *svc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (BLE_MESH_UUID_16(svc->attrs[0].user_data)->val == BT_UUID_MESH_PROXY_VAL) {
|
if (BLE_MESH_UUID_16(svc->attrs[0].user_data)->val == BT_UUID_MESH_PROXY_VAL) {
|
||||||
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL);
|
rc = ble_gatts_find_svc(BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL), &handle);
|
||||||
} else {
|
} else {
|
||||||
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL);
|
rc = ble_gatts_find_svc(BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL), &handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ble_gatts_find_svc(uuid, &handle);
|
|
||||||
assert(rc == 0);
|
assert(rc == 0);
|
||||||
ble_gatts_svc_set_visibility(handle, 0);
|
ble_gatts_svc_set_visibility(handle, 0);
|
||||||
|
|
||||||
@ -1336,15 +1334,13 @@ int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
uint16_t handle;
|
uint16_t handle;
|
||||||
const ble_uuid_t *uuid;
|
|
||||||
|
|
||||||
if (BLE_MESH_UUID_16(svc->attrs[0].user_data)->val == BT_UUID_MESH_PROXY_VAL) {
|
if (BLE_MESH_UUID_16(svc->attrs[0].user_data)->val == BT_UUID_MESH_PROXY_VAL) {
|
||||||
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL);
|
rc = ble_gatts_find_svc(BLE_UUID16_DECLARE(BT_UUID_MESH_PROXY_VAL), &handle);
|
||||||
} else {
|
} else {
|
||||||
uuid = BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL);
|
rc = ble_gatts_find_svc(BLE_UUID16_DECLARE(BT_UUID_MESH_PROV_VAL), &handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ble_gatts_find_svc(uuid, &handle);
|
|
||||||
assert(rc == 0);
|
assert(rc == 0);
|
||||||
ble_gatts_svc_set_visibility(handle, 1);
|
ble_gatts_svc_set_visibility(handle, 1);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user