mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-10-31 04:59:55 +00:00 
			
		
		
		
	Merge branch 'bugfix/fix_memory_leak_in_sco_v5.4' into 'release/v5.4'
fix(bt/bluedroid): Fix memory leak in sco when bluedroid disable (v5.4) See merge request espressif/esp-idf!34564
This commit is contained in:
		| @@ -1,4 +1,4 @@ | |||||||
| [codespell] | [codespell] | ||||||
| skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem | 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 | write-changes = true | ||||||
|   | |||||||
| @@ -110,6 +110,9 @@ void btm_free(void) | |||||||
|     fixed_queue_free(btm_cb.sec_pending_q, osi_free_func); |     fixed_queue_free(btm_cb.sec_pending_q, osi_free_func); | ||||||
|     btm_acl_free(); |     btm_acl_free(); | ||||||
|     btm_sec_dev_free(); |     btm_sec_dev_free(); | ||||||
|  | #if BTM_SCO_INCLUDED == TRUE | ||||||
|  |     btm_sco_free(); | ||||||
|  | #endif | ||||||
| #if BTM_DYNAMIC_MEMORY | #if BTM_DYNAMIC_MEMORY | ||||||
|     FREE_AND_RESET(btm_cb_ptr); |     FREE_AND_RESET(btm_cb_ptr); | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -123,6 +123,22 @@ void btm_sco_init (void) | |||||||
|     btm_cb.sco_cb.desired_sco_mode = BTM_DEFAULT_SCO_MODE; |     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 | ** 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 | **                               pointer is used, PCM parameter maintained in | ||||||
| **                               the control block will be used; otherwise update | **                               the control block will be used; otherwise update | ||||||
| **                               control block value. | **                               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. | **                                or not. | ||||||
| ** | ** | ||||||
| ** Returns          BTM_SUCCESS if the successful. | ** 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++) { |     for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++) { | ||||||
|         /* |         /* | ||||||
|          * If the sco state is in the SCO_ST_CONNECTING state, we still need |          * 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 && |         int rem_bd_matches = p->rem_bd_known && | ||||||
|                              !memcmp (p->esco.data.bd_addr, bda, BD_ADDR_LEN); |                              !memcmp (p->esco.data.bd_addr, bda, BD_ADDR_LEN); | ||||||
|   | |||||||
| @@ -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_init (void); | ||||||
|  | void btm_sco_free(void); | ||||||
| void btm_sco_connected (UINT8 hci_status, BD_ADDR bda, UINT16 hci_handle, | void btm_sco_connected (UINT8 hci_status, BD_ADDR bda, UINT16 hci_handle, | ||||||
|                         tBTM_ESCO_DATA *p_esco_data); |                         tBTM_ESCO_DATA *p_esco_data); | ||||||
| void btm_esco_proc_conn_chg (UINT8 status, UINT16 handle, UINT8 tx_interval, | void btm_esco_proc_conn_chg (UINT8 status, UINT16 handle, UINT8 tx_interval, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jiang Jiang Jian
					Jiang Jiang Jian