Quellcode durchsuchen

Merge branch 'bugfix/btdm_config_bluedroid_mem_debug_github_#12631' into 'master'

component/bt: Change the osi_mem_dbg_init to the esp_bluedroid_init function.

See merge request !860

Jiang Jiang Jian vor 8 Jahren
Ursprung
Commit
06fa08b022

+ 4 - 0
components/bt/bluedroid/api/esp_bt_main.c

@@ -127,6 +127,10 @@ esp_err_t esp_bluedroid_init(void)
         return ESP_ERR_INVALID_STATE;
         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 = btc_main_get_future_p(BTC_MAIN_INIT_FUTURE);
     *future_p = future_new();
     *future_p = future_new();
     if (*future_p == NULL) {
     if (*future_p == NULL) {

+ 0 - 4
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)
 int bte_main_boot_entry(bluedroid_init_done_cb_t cb)
 {
 {
-#ifdef CONFIG_BLUEDROID_MEM_DEBUG
-    osi_mem_dbg_init();
-#endif
-
     if (gki_init()) {
     if (gki_init()) {
         LOG_ERROR("%s: Init GKI Module Failure.\n", __func__);
         LOG_ERROR("%s: Init GKI Module Failure.\n", __func__);
         return -1;
         return -1;

+ 1 - 1
components/bt/bluedroid/osi/allocator.c

@@ -118,7 +118,7 @@ void osi_mem_dbg_show(void)
 char *osi_strdup(const char *str)
 char *osi_strdup(const char *str)
 {
 {
     size_t size = strlen(str) + 1;  // + 1 for the null terminator
     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) {
     if (!new_string) {
         return NULL;
         return NULL;

+ 1 - 0
components/bt/bluedroid/osi/include/allocator.h

@@ -21,6 +21,7 @@
 
 
 #include <stddef.h>
 #include <stddef.h>
 //#include <stdlib.h>
 //#include <stdlib.h>
+#include "sdkconfig.h"
 
 
 typedef void *(*alloc_fn)(size_t size);
 typedef void *(*alloc_fn)(size_t size);
 typedef void (*free_fn)(void *ptr);
 typedef void (*free_fn)(void *ptr);