fix(bt/bluedroid): Fixed HID memory leak

This commit is contained in:
liqigan
2025-11-13 17:44:08 +08:00
parent 859184aa55
commit ed7e22cdc7
9 changed files with 17 additions and 16 deletions
@@ -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;
@@ -759,7 +761,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;
@@ -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;
@@ -1168,7 +1170,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;
@@ -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);
@@ -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);