ESP32: Fix memory leak in controller deinit function

Added change to dealloc s_pm_lock in controller deinit as it gets allocated
during init procedure.

Closes https://github.com/espressif/esp-idf/issues/7653
This commit is contained in:
Rahul Tank 2021-10-08 14:34:47 +05:30
parent 71fc5fa478
commit 7f9a15f298
2 changed files with 17 additions and 17 deletions

View File

@ -1,16 +1,8 @@
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stddef.h>
#include <stdlib.h>
@ -1752,9 +1744,18 @@ esp_err_t esp_bt_controller_deinit(void)
esp_pm_lock_delete(s_light_sleep_pm_lock);
s_light_sleep_pm_lock = NULL;
}
esp_timer_stop(s_btdm_slp_tmr);
esp_timer_delete(s_btdm_slp_tmr);
s_btdm_slp_tmr = NULL;
if (s_pm_lock != NULL) {
esp_pm_lock_delete(s_pm_lock);
s_pm_lock = NULL;
}
if (s_btdm_slp_tmr != NULL) {
esp_timer_stop(s_btdm_slp_tmr);
esp_timer_delete(s_btdm_slp_tmr);
s_btdm_slp_tmr = NULL;
}
s_pm_lock_acquired = false;
#endif
semphr_delete_wrapper(s_wakeup_req_sem);

View File

@ -70,7 +70,6 @@ components/bt/common/osi/mutex.c
components/bt/common/osi/osi.c
components/bt/common/osi/semaphore.c
components/bt/common/osi/thread.c
components/bt/controller/esp32/bt.c
components/bt/controller/esp32/hli_api.c
components/bt/controller/esp32/hli_api.h
components/bt/controller/esp32c3/bt.c