mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/btdm_memleak_of_ble_set_security_param_v3.0' into 'release/v3.0'
component/bt: Fix mem leak of esp_ble_gap_set_security_param See merge request idf/esp-idf!2476
This commit is contained in:
commit
6ceedabb27
@ -522,7 +522,6 @@ static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBT
|
||||
}
|
||||
|
||||
LOG_DEBUG("API_Ble_AppStartAdvertising\n");
|
||||
|
||||
memcpy(peer_addr.bda, ble_adv_params->peer_addr, ESP_BD_ADDR_LEN);
|
||||
peer_addr.type = ble_adv_params->peer_addr_type;
|
||||
BTA_DmSetBleAdvParamsAll(ble_adv_params->adv_int_min,
|
||||
@ -1010,6 +1009,13 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BLE_SET_SECURITY_PARAM_EVT: {
|
||||
uint8_t *value = ((btc_ble_gap_args_t *)msg->arg)->set_security_param.value;
|
||||
if (value) {
|
||||
osi_free(value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG_DEBUG("Unhandled deep free %d\n", msg->act);
|
||||
break;
|
||||
@ -1108,36 +1114,37 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BLE_SET_SECURITY_PARAM_EVT: {
|
||||
uint8_t *value = arg->set_security_param.value;
|
||||
switch(arg->set_security_param.param_type) {
|
||||
case ESP_BLE_SM_PASSKEY:
|
||||
break;
|
||||
case ESP_BLE_SM_AUTHEN_REQ_MODE: {
|
||||
uint8_t authen_req = 0;
|
||||
STREAM_TO_UINT8(authen_req, arg->set_security_param.value);
|
||||
STREAM_TO_UINT8(authen_req, value);
|
||||
bta_dm_co_ble_set_auth_req(authen_req);
|
||||
break;
|
||||
}
|
||||
case ESP_BLE_SM_IOCAP_MODE: {
|
||||
uint8_t iocap = 0;
|
||||
STREAM_TO_UINT8(iocap, arg->set_security_param.value);
|
||||
STREAM_TO_UINT8(iocap, value);
|
||||
bta_dm_co_ble_set_io_cap(iocap);
|
||||
break;
|
||||
}
|
||||
case ESP_BLE_SM_SET_INIT_KEY: {
|
||||
uint8_t init_key = 0;
|
||||
STREAM_TO_UINT8(init_key, arg->set_security_param.value);
|
||||
STREAM_TO_UINT8(init_key, value);
|
||||
bta_dm_co_ble_set_init_key_req(init_key);
|
||||
break;
|
||||
}
|
||||
case ESP_BLE_SM_SET_RSP_KEY: {
|
||||
uint8_t rsp_key = 0;
|
||||
STREAM_TO_UINT8(rsp_key, arg->set_security_param.value);
|
||||
STREAM_TO_UINT8(rsp_key, value);
|
||||
bta_dm_co_ble_set_rsp_key_req(rsp_key);
|
||||
break;
|
||||
}
|
||||
case ESP_BLE_SM_MAX_KEY_SIZE: {
|
||||
uint8_t key_size = 0;
|
||||
STREAM_TO_UINT8(key_size, arg->set_security_param.value);
|
||||
STREAM_TO_UINT8(key_size, value);
|
||||
bta_dm_co_ble_set_max_key_size(key_size);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user