mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
fix(bt/bluedroid): Fixed freeing spp server memory when disconnected
This commit is contained in:
@ -1058,7 +1058,7 @@ void sdp_bqb_add_language_attr_ctrl(BOOLEAN enable)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adds a protocol list and service name (if provided) to an SDP record given by
|
* @brief Adds a protocol list and service name (if provided) to an SDP record given by
|
||||||
* sdp_handle, and marks it as browseable. This is a shortcut for defining a
|
* sdp_handle, and marks it as browsable. This is a shortcut for defining a
|
||||||
* set of protocols that includes L2CAP, RFCOMM, and optionally OBEX.
|
* set of protocols that includes L2CAP, RFCOMM, and optionally OBEX.
|
||||||
*
|
*
|
||||||
* @param[in] sdp_handle: SDP handle
|
* @param[in] sdp_handle: SDP handle
|
||||||
@ -1133,9 +1133,9 @@ static bool create_base_record(const uint32_t sdp_handle, const char *name, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark the service as browseable.
|
// Mark the service as browsable.
|
||||||
uint16_t list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
|
uint16_t list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
|
||||||
stage = "browseable";
|
stage = "browsable";
|
||||||
if (!SDP_AddUuidSequence(sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &list)){
|
if (!SDP_AddUuidSequence(sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &list)){
|
||||||
APPL_TRACE_ERROR("create_base_record: failed to create base service "
|
APPL_TRACE_ERROR("create_base_record: failed to create base service "
|
||||||
"record, stage: %s, scn: %d, name: %s, with_obex: %d",
|
"record, stage: %s, scn: %d, name: %s, with_obex: %d",
|
||||||
@ -1754,6 +1754,7 @@ static void bta_jv_port_mgmt_cl_cback(UINT32 code, UINT16 port_handle, void* dat
|
|||||||
evt_data.rfc_close.status = BTA_JV_FAILURE;
|
evt_data.rfc_close.status = BTA_JV_FAILURE;
|
||||||
evt_data.rfc_close.port_status = code;
|
evt_data.rfc_close.port_status = code;
|
||||||
evt_data.rfc_close.async = TRUE;
|
evt_data.rfc_close.async = TRUE;
|
||||||
|
evt_data.rfc_close.user_data = p_pcb->user_data;
|
||||||
if (p_pcb->state == BTA_JV_ST_CL_CLOSING) {
|
if (p_pcb->state == BTA_JV_ST_CL_CLOSING) {
|
||||||
evt_data.rfc_close.async = FALSE;
|
evt_data.rfc_close.async = FALSE;
|
||||||
evt_data.rfc_close.status = BTA_JV_SUCCESS;
|
evt_data.rfc_close.status = BTA_JV_SUCCESS;
|
||||||
@ -2082,6 +2083,7 @@ static void bta_jv_port_mgmt_sr_cback(UINT32 code, UINT16 port_handle, void *dat
|
|||||||
evt_data.rfc_close.status = BTA_JV_FAILURE;
|
evt_data.rfc_close.status = BTA_JV_FAILURE;
|
||||||
evt_data.rfc_close.async = TRUE;
|
evt_data.rfc_close.async = TRUE;
|
||||||
evt_data.rfc_close.port_status = code;
|
evt_data.rfc_close.port_status = code;
|
||||||
|
evt_data.rfc_close.user_data = user_data;
|
||||||
p_pcb->cong = FALSE;
|
p_pcb->cong = FALSE;
|
||||||
|
|
||||||
tBTA_JV_RFCOMM_CBACK *p_cback = p_cb->p_cback;
|
tBTA_JV_RFCOMM_CBACK *p_cback = p_cb->p_cback;
|
||||||
|
@ -1165,7 +1165,7 @@ void btc_spp_cb_handler(btc_msg_t *msg)
|
|||||||
param.close.async = p_data->rfc_close.async;
|
param.close.async = p_data->rfc_close.async;
|
||||||
if (spp_local_param.spp_mode == ESP_SPP_MODE_CB) {
|
if (spp_local_param.spp_mode == ESP_SPP_MODE_CB) {
|
||||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||||
slot = spp_find_slot_by_handle(p_data->rfc_close.handle);
|
slot = spp_find_slot_by_id((uint32_t)p_data->rfc_close.user_data);
|
||||||
if (!slot) {
|
if (!slot) {
|
||||||
param.close.status = ESP_SPP_NO_CONNECTION;
|
param.close.status = ESP_SPP_NO_CONNECTION;
|
||||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||||
@ -1179,7 +1179,7 @@ void btc_spp_cb_handler(btc_msg_t *msg)
|
|||||||
bool need_call = true;
|
bool need_call = true;
|
||||||
do {
|
do {
|
||||||
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
osi_mutex_lock(&spp_local_param.spp_slot_mutex, OSI_MUTEX_MAX_TIMEOUT);
|
||||||
slot = spp_find_slot_by_handle(p_data->rfc_close.handle);
|
slot = spp_find_slot_by_id((uint32_t)p_data->rfc_close.user_data);
|
||||||
if (!slot) {
|
if (!slot) {
|
||||||
param.close.status = ESP_SPP_NO_CONNECTION;
|
param.close.status = ESP_SPP_NO_CONNECTION;
|
||||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||||
|
Reference in New Issue
Block a user