mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
fix(bt/bluedroid): Avoided crash of LoadProhibited during HFP AG deinitialization
Move the release of the control blocks from the start of deinitialization to the profile disabled event.
This commit is contained in:
@@ -354,13 +354,16 @@ void btc_hf_deinit(void)
|
|||||||
{
|
{
|
||||||
BTC_TRACE_EVENT("%s", __FUNCTION__);
|
BTC_TRACE_EVENT("%s", __FUNCTION__);
|
||||||
btc_dm_disable_service(BTA_HFP_SERVICE_ID);
|
btc_dm_disable_service(BTA_HFP_SERVICE_ID);
|
||||||
|
hf_local_param[0].btc_hf_cb.initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void btc_hf_cb_release(void)
|
||||||
|
{
|
||||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||||
if (hf_local_param) {
|
if (hf_local_param) {
|
||||||
osi_free(hf_local_param);
|
osi_free(hf_local_param);
|
||||||
hf_local_param = NULL;
|
hf_local_param = NULL;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
hf_local_param[0].btc_hf_cb.initialized = false;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1260,9 +1263,12 @@ void btc_hf_cb_handler(btc_msg_t *msg)
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case BTA_AG_ENABLE_EVT:
|
case BTA_AG_ENABLE_EVT:
|
||||||
case BTA_AG_DISABLE_EVT:
|
|
||||||
break;
|
break;
|
||||||
|
case BTA_AG_DISABLE_EVT:
|
||||||
|
{
|
||||||
|
btc_hf_cb_release();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case BTA_AG_REGISTER_EVT:
|
case BTA_AG_REGISTER_EVT:
|
||||||
{
|
{
|
||||||
idx = p_data->hdr.handle - 1;
|
idx = p_data->hdr.handle - 1;
|
||||||
|
Reference in New Issue
Block a user