diff --git a/components/bt/common/osi/allocator.c b/components/bt/common/osi/allocator.c index 86fb705b071..0293daa8c4e 100644 --- a/components/bt/common/osi/allocator.c +++ b/components/bt/common/osi/allocator.c @@ -241,8 +241,5 @@ void *osi_calloc_func(size_t size) void osi_free_func(void *ptr) { -#if HEAP_MEMORY_DEBUG - osi_mem_dbg_clean(ptr, __func__, __LINE__); -#endif - free(ptr); + osi_free(ptr); } diff --git a/components/bt/host/bluedroid/api/esp_hidd_api.c b/components/bt/host/bluedroid/api/esp_hidd_api.c index d7c043666d1..483ba412919 100644 --- a/components/bt/host/bluedroid/api/esp_hidd_api.c +++ b/components/bt/host/bluedroid/api/esp_hidd_api.c @@ -133,7 +133,7 @@ esp_err_t esp_bt_hid_device_send_report(esp_hidd_report_type_t type, uint8_t id, args.send_report.data = data; bt_status_t stat = btc_transfer_context(&msg, &args, sizeof(btc_hidd_args_t), - btc_hd_arg_deep_copy, btc_hd_cb_arg_deep_free); + btc_hd_arg_deep_copy, btc_hd_call_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/api/esp_hidh_api.c b/components/bt/host/bluedroid/api/esp_hidh_api.c index e029ee654a0..f1c39bded88 100644 --- a/components/bt/host/bluedroid/api/esp_hidh_api.c +++ b/components/bt/host/bluedroid/api/esp_hidh_api.c @@ -117,7 +117,7 @@ esp_err_t esp_bt_hid_host_set_info(esp_bd_addr_t bd_addr, esp_hidh_hid_info_t *h arg.set_info.hid_info = hid_info; bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), - btc_hh_arg_deep_copy, btc_hh_cb_arg_deep_free); + btc_hh_arg_deep_copy, btc_hh_call_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -224,7 +224,7 @@ esp_err_t esp_bt_hid_host_set_report(esp_bd_addr_t bd_addr, esp_hidh_report_type arg.set_report.report = report; bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), - btc_hh_arg_deep_copy, btc_hh_cb_arg_deep_free); + btc_hh_arg_deep_copy, btc_hh_call_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } @@ -243,7 +243,7 @@ esp_err_t esp_bt_hid_host_send_data(esp_bd_addr_t bd_addr, uint8_t *data, size_t arg.send_data.data = data; bt_status_t stat = btc_transfer_context(&msg, &arg, sizeof(btc_hidh_args_t), - btc_hh_arg_deep_copy, btc_hh_cb_arg_deep_free); + btc_hh_arg_deep_copy, btc_hh_call_arg_deep_free); return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL; } diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c index 82ff2b8d5c8..29019fc8813 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hd.c @@ -75,6 +75,8 @@ btc_hd_cb_t btc_hd_cb = {0}; typedef void (bt_hid_copy_cb_t)(btc_msg_t *msg, void *p_dest, void *p_src); +static void btc_hd_cb_arg_deep_free(btc_msg_t *msg); + static inline void btc_hd_cb_to_app(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param) { esp_hd_cb_t btc_hd_cb = (esp_hd_cb_t)btc_profile_cb_get(BTC_PID_HD); @@ -705,7 +707,7 @@ static void btc_hd_virtual_cable_unplug(void) } } -static void btc_hd_call_arg_deep_free(btc_msg_t *msg) +void btc_hd_call_arg_deep_free(btc_msg_t *msg) { btc_hidd_args_t *arg = (btc_hidd_args_t *)msg->arg; @@ -756,7 +758,7 @@ void btc_hd_call_handler(btc_msg_t *msg) btc_hd_call_arg_deep_free(msg); } -void btc_hd_cb_arg_deep_free(btc_msg_t *msg) +static void btc_hd_cb_arg_deep_free(btc_msg_t *msg) { tBTA_HD *arg = (tBTA_HD *)msg->arg; diff --git a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c index 55fe3f69b37..c7adef20069 100644 --- a/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c +++ b/components/bt/host/bluedroid/btc/profile/std/hid/btc_hh.c @@ -64,6 +64,8 @@ static bdstr_t bdstr; #define is_hidh_init() (btc_hh_cb.status > BTC_HH_DISABLED) #define BTC_TIMEOUT_VUP_MS (3 * 1000) +static void btc_hh_cb_arg_deep_free(btc_msg_t *msg); + static inline void btc_hh_cb_to_app(esp_hidh_cb_event_t event, esp_hidh_cb_param_t *param) { esp_hh_cb_t btc_hh_cb = (esp_hh_cb_t)btc_profile_cb_get(BTC_PID_HH); @@ -1097,7 +1099,7 @@ static void btc_hh_set_idle_time(btc_hidh_args_t *arg) } } -static void btc_hh_call_arg_deep_free(btc_msg_t *msg) +void btc_hh_call_arg_deep_free(btc_msg_t *msg) { btc_hidh_args_t *arg = (btc_hidh_args_t *)msg->arg; @@ -1166,7 +1168,7 @@ void btc_hh_call_handler(btc_msg_t *msg) btc_hh_call_arg_deep_free(msg); } -void btc_hh_cb_arg_deep_free(btc_msg_t *msg) +static void btc_hh_cb_arg_deep_free(btc_msg_t *msg) { tBTA_HH *arg = (tBTA_HH *)msg->arg; diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_hd.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_hd.h index 15b59393a32..fa01953e842 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_hd.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_hd.h @@ -99,7 +99,7 @@ void btc_hd_call_handler(btc_msg_t *msg); void btc_hd_cb_handler(btc_msg_t *msg); void btc_hd_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); -void btc_hd_cb_arg_deep_free(btc_msg_t *msg); +void btc_hd_call_arg_deep_free(btc_msg_t *msg); void btc_hd_get_profile_status(esp_hidd_profile_status_t *param); diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_hh.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_hh.h index f1158c6fddf..827cd095c75 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_hh.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_hh.h @@ -181,8 +181,7 @@ void btc_hh_call_handler(btc_msg_t *msg); void btc_hh_cb_handler(btc_msg_t *msg); void btc_hh_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src); - -void btc_hh_cb_arg_deep_free(btc_msg_t *msg); +void btc_hh_call_arg_deep_free(btc_msg_t *msg); bool btc_hh_add_added_dev(BD_ADDR bd_addr, uint16_t attr_mask); diff --git a/components/bt/host/bluedroid/stack/hid/hidd_conn.c b/components/bt/host/bluedroid/stack/hid/hidd_conn.c index 5a8e36ee599..5c9164c2c53 100644 --- a/components/bt/host/bluedroid/stack/hid/hidd_conn.c +++ b/components/bt/host/bluedroid/stack/hid/hidd_conn.c @@ -775,6 +775,7 @@ tHID_STATUS hidd_conn_send_data(uint8_t channel, uint8_t msg_type, uint8_t param } return HID_SUCCESS; } + osi_free(p_buf); return HID_ERR_NO_CONNECTION; } #ifdef REPORT_TRANSFER_TIMESTAMP diff --git a/components/bt/host/bluedroid/stack/l2cap/l2c_utils.c b/components/bt/host/bluedroid/stack/l2cap/l2c_utils.c index 64ebcbd4363..a48eb0d1506 100644 --- a/components/bt/host/bluedroid/stack/l2cap/l2c_utils.c +++ b/components/bt/host/bluedroid/stack/l2cap/l2c_utils.c @@ -25,7 +25,6 @@ #include #include -#include "osi/allocator.h" #include "device/controller.h" #include "stack/bt_types.h" #include "stack/hcimsgs.h" @@ -36,6 +35,7 @@ #include "stack/btm_api.h" #include "btm_int.h" #include "stack/hcidefs.h" +#include "bt_common.h" #include "osi/allocator.h" #include "osi/list.h"