fix SPP init deynamic memory bugs

This commit is contained in:
liqigan 2020-12-02 12:24:05 +08:00
parent c33fc7821a
commit 25774f41db
3 changed files with 17 additions and 7 deletions

View File

@ -43,15 +43,22 @@
* between BTA_JvEnable and BTA_JvDisable
* p_bta_jv_cfg->p_sdp_raw_data can be allocated before calling BTA_JvStartDiscovery
* it can be de-allocated after the last call to access the database */
#if BTA_DYNAMIC_MEMORY == FALSE
static UINT8 bta_jv_sdp_raw_data[BTA_JV_SDP_RAW_DATA_SIZE];
static UINT8 __attribute__ ((aligned(4))) bta_jv_sdp_db_data[BTA_JV_SDP_DB_SIZE];
#endif
/* JV configuration structure */
const tBTA_JV_CFG bta_jv_cfg = {
BTA_JV_SDP_RAW_DATA_SIZE, /* The size of p_sdp_raw_data */
BTA_JV_SDP_DB_SIZE, /* The size of p_sdp_db_data */
bta_jv_sdp_raw_data, /* The data buffer to keep raw data */
/* const */ tBTA_JV_CFG bta_jv_cfg = {
BTA_JV_SDP_RAW_DATA_SIZE, /* The size of p_sdp_raw_data */
BTA_JV_SDP_DB_SIZE, /* The size of p_sdp_db_data */
#if BTA_DYNAMIC_MEMORY == FALSE
bta_jv_sdp_raw_data, /* The data buffer to keep raw data */
(tSDP_DISCOVERY_DB *)bta_jv_sdp_db_data /* The data buffer to keep SDP database */
#else
NULL,
NULL
#endif
};
tBTA_JV_CFG *p_bta_jv_cfg = (tBTA_JV_CFG *) &bta_jv_cfg;

View File

@ -35,6 +35,8 @@
#if BTA_DYNAMIC_MEMORY == FALSE
tBTA_JV_CB bta_jv_cb;
#else
tBTA_JV_CB *bta_jv_cb_ptr;
#endif
/* state machine action enumeration list */

View File

@ -116,7 +116,6 @@
#if BTA_JV_INCLUDED==TRUE
#include "bta_jv_int.h"
tBTA_JV_CB *bta_jv_cb_ptr = NULL;
#endif
#if BTA_HL_INCLUDED == TRUE
@ -332,8 +331,10 @@ void BTE_DeinitStack(void)
bta_sdp_cb_ptr = NULL;
#endif
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
osi_free(bta_jv_cb_ptr);
bta_jv_cb_ptr = NULL;
if (bta_jv_cb_ptr) {
osi_free(bta_jv_cb_ptr);
bta_jv_cb_ptr = NULL;
}
#endif //JV
#if (defined BTA_HF_INCLUDED && BTA_HF_INCLUDED == TRUE)
osi_free(bta_hf_client_cb_ptr);