fix(bt/bluedroid): Fix memory leak in sco when bluedroid disable

pull/12126/merge
linruihao 2024-10-30 15:05:17 +08:00
rodzic 06da32f9f2
commit ecefb3c7e5
4 zmienionych plików z 23 dodań i 3 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
[codespell]
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,wel,ot,fane,assertIn,registr,oen
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,wel,ot,fane,assertIn,registr,oen,parms
write-changes = true

Wyświetl plik

@ -110,6 +110,9 @@ void btm_free(void)
fixed_queue_free(btm_cb.sec_pending_q, osi_free_func);
btm_acl_free();
btm_sec_dev_free();
#if BTM_SCO_INCLUDED == TRUE
btm_sco_free();
#endif
#if BTM_DYNAMIC_MEMORY
FREE_AND_RESET(btm_cb_ptr);
#endif

Wyświetl plik

@ -123,6 +123,22 @@ void btm_sco_init (void)
btm_cb.sco_cb.desired_sco_mode = BTM_DEFAULT_SCO_MODE;
}
/*******************************************************************************
**
** Function btm_sco_free
**
** Description Free sco specific fixed_queue from btm control block
**
*******************************************************************************/
void btm_sco_free(void)
{
#if (BTM_SCO_HCI_INCLUDED == TRUE)
for (int i = 0; i < BTM_MAX_SCO_LINKS; i++) {
fixed_queue_free(btm_cb.sco_cb.sco_db[i].xmit_data_q, osi_free_func);
}
#endif
}
/*******************************************************************************
**
** Function btm_esco_conn_rsp
@ -233,7 +249,7 @@ void btm_sco_process_num_bufs (UINT16 num_lm_sco_bufs)
** pointer is used, PCM parameter maintained in
** the control block will be used; otherwise update
** control block value.
** err_data_rpt: Lisbon feature to enable the erronous data report
** err_data_rpt: Lisbon feature to enable the erroneous data report
** or not.
**
** Returns BTM_SUCCESS if the successful.
@ -947,7 +963,7 @@ void btm_sco_conn_req (BD_ADDR bda, DEV_CLASS dev_class, UINT8 link_type)
for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) {
/*
* If the sco state is in the SCO_ST_CONNECTING state, we still need
* to return accept sco to avoid race conditon for sco creation
* to return accept sco to avoid race condition for sco creation
*/
int rem_bd_matches = p->rem_bd_known &&
!memcmp (p->esco.data.bd_addr, bda, BD_ADDR_LEN);

Wyświetl plik

@ -1119,6 +1119,7 @@ void btm_ble_periodic_adv_sync_trans_complete(UINT16 op_code, UINT8 hci_status,
********************************************
*/
void btm_sco_init (void);
void btm_sco_free(void);
void btm_sco_connected (UINT8 hci_status, BD_ADDR bda, UINT16 hci_handle,
tBTM_ESCO_DATA *p_esco_data);
void btm_esco_proc_conn_chg (UINT8 status, UINT16 handle, UINT8 tx_interval,