From 2a759a9864fbe460d157dda38aa77b9d733e891e Mon Sep 17 00:00:00 2001 From: Yulong Date: Tue, 13 Jun 2017 08:52:26 -0400 Subject: [PATCH] component/bt: Change the osi_mem_dbg_init to the esp_bluedroid_init function. --- components/bt/bluedroid/api/esp_bt_main.c | 4 ++++ components/bt/bluedroid/main/bte_main.c | 4 ---- components/bt/bluedroid/osi/allocator.c | 2 +- components/bt/bluedroid/osi/include/allocator.h | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/bt/bluedroid/api/esp_bt_main.c b/components/bt/bluedroid/api/esp_bt_main.c index 549865e74..deb6114bc 100644 --- a/components/bt/bluedroid/api/esp_bt_main.c +++ b/components/bt/bluedroid/api/esp_bt_main.c @@ -119,6 +119,10 @@ esp_err_t esp_bluedroid_init(void) return ESP_ERR_INVALID_STATE; } +#ifdef CONFIG_BLUEDROID_MEM_DEBUG + osi_mem_dbg_init(); +#endif + future_p = btc_main_get_future_p(BTC_MAIN_INIT_FUTURE); *future_p = future_new(); if (*future_p == NULL) { diff --git a/components/bt/bluedroid/main/bte_main.c b/components/bt/bluedroid/main/bte_main.c index 957580f0c..2705bff9b 100644 --- a/components/bt/bluedroid/main/bte_main.c +++ b/components/bt/bluedroid/main/bte_main.c @@ -117,10 +117,6 @@ extern void osi_mem_dbg_init(void); ******************************************************************************/ int bte_main_boot_entry(bluedroid_init_done_cb_t cb) { -#ifdef CONFIG_BLUEDROID_MEM_DEBUG - osi_mem_dbg_init(); -#endif - if (gki_init()) { LOG_ERROR("%s: Init GKI Module Failure.\n", __func__); return -1; diff --git a/components/bt/bluedroid/osi/allocator.c b/components/bt/bluedroid/osi/allocator.c index 9dc3ee910..be90dfc24 100644 --- a/components/bt/bluedroid/osi/allocator.c +++ b/components/bt/bluedroid/osi/allocator.c @@ -118,7 +118,7 @@ void osi_mem_dbg_show(void) char *osi_strdup(const char *str) { size_t size = strlen(str) + 1; // + 1 for the null terminator - char *new_string = (char *)calloc(1, size); + char *new_string = (char *)osi_calloc(size); if (!new_string) { return NULL; diff --git a/components/bt/bluedroid/osi/include/allocator.h b/components/bt/bluedroid/osi/include/allocator.h index 17a3a2463..82ef5b0ea 100644 --- a/components/bt/bluedroid/osi/include/allocator.h +++ b/components/bt/bluedroid/osi/include/allocator.h @@ -21,6 +21,7 @@ #include //#include +#include "sdkconfig.h" typedef void *(*alloc_fn)(size_t size); typedef void (*free_fn)(void *ptr);