mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/ag_use_dynamic_memory_error' into 'master'
Fix ag use dynamic memory error Closes BT-1574 See merge request espressif/esp-idf!13094
This commit is contained in:
commit
7b2f2c2a86
@ -53,7 +53,11 @@
|
||||
/* Max HF Clients Supported From App */
|
||||
static UINT16 btc_max_hf_clients = 1;
|
||||
/* HF Param Definition */
|
||||
#if HFP_DYNAMIC_MEMORY == FALSE
|
||||
static hf_local_param_t hf_local_param[BTC_HF_NUM_CB];
|
||||
#else
|
||||
static hf_local_param_t *hf_local_param;
|
||||
#endif
|
||||
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
#ifndef BTC_HF_FEATURES
|
||||
@ -296,7 +300,15 @@ bt_status_t btc_hf_execute_service(BOOLEAN b_enable)
|
||||
************************************************************************************/
|
||||
bt_status_t btc_hf_init(bt_bdaddr_t *bd_addr)
|
||||
{
|
||||
int idx = btc_hf_idx_by_bdaddr(bd_addr);
|
||||
int idx = 0;
|
||||
UNUSED(bd_addr);
|
||||
|
||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||
if ((hf_local_param = (hf_local_param_t *)osi_malloc(sizeof(hf_local_param_t) * BTC_HF_NUM_CB)) == NULL) {
|
||||
return BT_STATUS_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
BTC_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btc_max_hf_clients);
|
||||
/* Invoke the enable service API to the core to set the appropriate service_id
|
||||
* Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
|
||||
@ -322,10 +334,18 @@ bt_status_t btc_hf_init(bt_bdaddr_t *bd_addr)
|
||||
|
||||
void btc_hf_deinit(bt_bdaddr_t *bd_addr)
|
||||
{
|
||||
int idx = btc_hf_idx_by_bdaddr(bd_addr);
|
||||
UNUSED(bd_addr);
|
||||
|
||||
BTC_TRACE_EVENT("%s", __FUNCTION__);
|
||||
btc_dm_disable_service(BTA_HFP_SERVICE_ID);
|
||||
hf_local_param[idx].btc_hf_cb.initialized = false;
|
||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||
if (hf_local_param) {
|
||||
osi_free(hf_local_param);
|
||||
hf_local_param = NULL;
|
||||
}
|
||||
#else
|
||||
hf_local_param[0].btc_hf_cb.initialized = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bt_status_t connect_init(bt_bdaddr_t *bd_addr, uint16_t uuid)
|
||||
|
@ -206,11 +206,6 @@ typedef union
|
||||
/* APP ID definition*/
|
||||
#define BTC_HF_ID_1 0
|
||||
|
||||
#if HFP_DYNAMIC_MEMORY == TRUE
|
||||
extern hf_local_param_t *hf_local_param_ptr;
|
||||
#define hf_local_param (*hf_local_param_ptr)
|
||||
#endif
|
||||
|
||||
/* BTC-AG control block to map bdaddr to BTA handle */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -93,6 +93,10 @@
|
||||
#include "bta_hf_client_int.h"
|
||||
#endif
|
||||
|
||||
#if BTA_AG_INCLUDED == TRUE
|
||||
#include "bta_ag_int.h"
|
||||
#endif
|
||||
|
||||
#if BTA_SDP_INCLUDED == TRUE
|
||||
#include "bta_sdp_int.h"
|
||||
#endif
|
||||
@ -216,6 +220,12 @@ void BTE_DeinitStack(void)
|
||||
osi_free(bta_hf_client_cb_ptr);
|
||||
bta_hf_client_cb_ptr = NULL;
|
||||
}
|
||||
#endif
|
||||
#if (defined BTA_AG_INCLUDED && BTA_AG_INCLUDED == TRUE)
|
||||
if (bta_ag_cb_ptr){
|
||||
osi_free(bta_ag_cb_ptr);
|
||||
bta_ag_cb_ptr = NULL;
|
||||
}
|
||||
#endif
|
||||
if (bta_dm_conn_srvcs_ptr){
|
||||
osi_free(bta_dm_conn_srvcs_ptr);
|
||||
@ -374,6 +384,12 @@ bt_status_t BTE_InitStack(void)
|
||||
}
|
||||
memset((void *)bta_hf_client_cb_ptr, 0, sizeof(tBTA_HF_CLIENT_CB));
|
||||
#endif
|
||||
#if (defined BTA_AG_INCLUDED && BTA_AG_INCLUDED == TRUE)
|
||||
if ((bta_ag_cb_ptr = (tBTA_AG_CB *)osi_malloc(sizeof(tBTA_AG_CB))) == NULL) {
|
||||
goto error_exit;
|
||||
}
|
||||
memset((void *)bta_ag_cb_ptr, 0, sizeof(tBTA_AG_CB));
|
||||
#endif
|
||||
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
|
||||
if ((bta_jv_cb_ptr = (tBTA_JV_CB *)osi_malloc(sizeof(tBTA_JV_CB))) == NULL) {
|
||||
goto error_exit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user