mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(bt): Fix heap corruption in the call of esp_bt_mem_release on ESP32
Closes https://github.com/espressif/esp-idf/issues/14263
This commit is contained in:
parent
ced444e49c
commit
fd4f4a2fa0
@ -1432,6 +1432,14 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode)
|
||||
.name = "BT Controller Data"
|
||||
};
|
||||
|
||||
/*
|
||||
* Free data and BSS section for Bluetooth controller ROM code.
|
||||
* Note that rom mem release must be performed before section _bt_data_start to _bt_data_end is released,
|
||||
* otherwise `btdm_dram_available_region` will no longer be available when performing rom mem release and
|
||||
* thus causing heap corruption.
|
||||
*/
|
||||
ret = esp_bt_controller_rom_mem_release(mode);
|
||||
|
||||
if (mode == ESP_BT_MODE_BTDM) {
|
||||
/* Start by freeing Bluetooth BSS section */
|
||||
if (ret == ESP_OK) {
|
||||
@ -1444,11 +1452,6 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode)
|
||||
}
|
||||
}
|
||||
|
||||
/* free data and BSS section for Bluetooth controller ROM code */
|
||||
if (ret == ESP_OK) {
|
||||
ret = esp_bt_controller_rom_mem_release(mode);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user