component/bt: Avoid PLC to use unallocated memory

Closes https://github.com/espressif/esp-idf/pull/3799
This commit is contained in:
baohongde
2019-07-26 14:39:50 +08:00
parent b0456cc926
commit d1f774bc0a
2 changed files with 9 additions and 2 deletions

View File

@@ -73,8 +73,8 @@ static bta_hf_client_co_cb_t *bta_hf_client_co_cb_ptr;
#define bta_hf_client_co_cb (*bta_hf_client_co_cb_ptr)
#endif /* HFP_DYNAMIC_MEMORY == FALSE */
static UINT8 hf_air_mode;
static UINT8 hf_inout_pkt_size;
static UINT8 hf_air_mode = BTM_SCO_AIR_MODE_UNKNOWN;
static UINT8 hf_inout_pkt_size = 0;
/*******************************************************************************
**
@@ -223,6 +223,9 @@ void bta_hf_client_sco_co_open(UINT16 handle, UINT8 air_mode, UINT8 inout_pkt_si
#if (HFP_DYNAMIC_MEMORY == TRUE)
error_exit:;
hf_air_mode = BTM_SCO_AIR_MODE_UNKNOWN;
hf_inout_pkt_size = 0;
if (bta_hf_client_co_cb_ptr) {
osi_free(bta_hf_client_co_cb_ptr);
bta_hf_client_co_cb_ptr = NULL;
@@ -271,6 +274,9 @@ void bta_hf_client_sco_co_close(void)
} else {
// Nothing to do
}
hf_air_mode = BTM_SCO_AIR_MODE_UNKNOWN;
hf_inout_pkt_size = 0;
}
/*******************************************************************************

View File

@@ -983,6 +983,7 @@ typedef UINT16 tBTM_SCO_CODEC_TYPE;
#define BTM_SCO_AIR_MODE_A_LAW 1
#define BTM_SCO_AIR_MODE_CVSD 2
#define BTM_SCO_AIR_MODE_TRANSPNT 3
#define BTM_SCO_AIR_MODE_UNKNOWN 0xFF
typedef UINT8 tBTM_SCO_AIR_MODE_TYPE;
/*******************