Skip to content

Commit

Permalink
Merge branch 'bugfix/memory_leak_init_deinit_blufi_example' into 'mas…
Browse files Browse the repository at this point in the history
…ter'

Fix: blufi example memory leak while init and deinit

Closes BT-2798

See merge request espressif/esp-idf!20196
  • Loading branch information
Isl2017 committed Sep 19, 2022
2 parents 96b73d3 + 77b8276 commit 728654a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/bt/controller/esp32c2/bt.c
Expand Up @@ -552,6 +552,19 @@ void controller_sleep_deinit(void)
r_ble_rtc_wake_up_state_clr();
#endif
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_AUTO);

/*lock should release first and then delete*/
if (s_pm_lock_acquired) {
if(s_light_sleep_pm_lock != NULL)
esp_pm_lock_release(s_light_sleep_pm_lock);
}

if(s_pm_lock != NULL) {
esp_pm_lock_release(s_pm_lock);
}
s_pm_lock_acquired = false;
}

if (!s_btdm_allow_light_sleep) {
if (s_light_sleep_pm_lock != NULL) {
esp_pm_lock_delete(s_light_sleep_pm_lock);
Expand Down

0 comments on commit 728654a

Please sign in to comment.