mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 09:39:10 -04:00
Merge branch 'bugfix/osi_replace_free_v5.1' into 'release/v5.1'
fix(bt/bluedroid): Replace free/malloc with osi_free/malloc(v5.1) See merge request espressif/esp-idf!34608
This commit is contained in:
commit
a628f0aef3
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -281,7 +281,7 @@ static void close_timeout_handler(void *arg)
|
||||
status = btc_transfer_context(&msg, slot->alarm_arg, sizeof(tBTA_JV), NULL, NULL);
|
||||
|
||||
if (slot->alarm_arg) {
|
||||
free(slot->alarm_arg);
|
||||
osi_free(slot->alarm_arg);
|
||||
slot->alarm_arg = NULL;
|
||||
}
|
||||
|
||||
@ -832,7 +832,7 @@ void btc_l2cap_cb_handler(btc_msg_t *msg)
|
||||
// if rx still has data, delay free slot
|
||||
if (slot->close_alarm == NULL && slot->rx.queue && fixed_queue_length(slot->rx.queue) > 0) {
|
||||
tBTA_JV *p_arg = NULL;
|
||||
if ((p_arg = malloc(sizeof(tBTA_JV))) == NULL) {
|
||||
if ((p_arg = osi_malloc(sizeof(tBTA_JV))) == NULL) {
|
||||
param.close.status = ESP_BT_L2CAP_NO_RESOURCE;
|
||||
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
|
||||
BTC_TRACE_ERROR("%s unable to malloc slot close_alarm arg!", __func__);
|
||||
@ -842,7 +842,7 @@ void btc_l2cap_cb_handler(btc_msg_t *msg)
|
||||
slot->alarm_arg = (void *)p_arg;
|
||||
if ((slot->close_alarm =
|
||||
osi_alarm_new("slot", close_timeout_handler, (void *)slot, VFS_CLOSE_TIMEOUT)) == NULL) {
|
||||
free(p_arg);
|
||||
osi_free(p_arg);
|
||||
slot->alarm_arg = NULL;
|
||||
param.close.status = ESP_BT_L2CAP_NO_RESOURCE;
|
||||
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
|
||||
@ -850,7 +850,7 @@ void btc_l2cap_cb_handler(btc_msg_t *msg)
|
||||
break;
|
||||
}
|
||||
if (osi_alarm_set(slot->close_alarm, VFS_CLOSE_TIMEOUT) != OSI_ALARM_ERR_PASS) {
|
||||
free(p_arg);
|
||||
osi_free(p_arg);
|
||||
slot->alarm_arg = NULL;
|
||||
osi_alarm_free(slot->close_alarm);
|
||||
param.close.status = ESP_BT_L2CAP_BUSY;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -1199,7 +1199,7 @@ void btc_spp_cb_handler(btc_msg_t *msg)
|
||||
slot->alarm_arg = (void *)p_arg;
|
||||
if ((slot->close_alarm =
|
||||
osi_alarm_new("slot", close_timeout_handler, (void *)slot, VFS_CLOSE_TIMEOUT)) == NULL) {
|
||||
free(p_arg);
|
||||
osi_free(p_arg);
|
||||
slot->alarm_arg = NULL;
|
||||
param.close.status = ESP_SPP_NO_RESOURCE;
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
@ -1207,7 +1207,7 @@ void btc_spp_cb_handler(btc_msg_t *msg)
|
||||
break;
|
||||
}
|
||||
if (osi_alarm_set(slot->close_alarm, VFS_CLOSE_TIMEOUT) != OSI_ALARM_ERR_PASS) {
|
||||
free(p_arg);
|
||||
osi_free(p_arg);
|
||||
slot->alarm_arg = NULL;
|
||||
osi_alarm_free(slot->close_alarm);
|
||||
param.close.status = ESP_SPP_BUSY;
|
||||
@ -1488,7 +1488,7 @@ static ssize_t spp_vfs_write(int fd, const void * data, size_t size)
|
||||
BTC_TRACE_DEBUG("%s items_waiting:%d, fd:%d\n", __func__, items_waiting, fd);
|
||||
osi_mutex_unlock(&spp_local_param.spp_slot_mutex);
|
||||
|
||||
// block untill under water level, be closed or time out
|
||||
// block until under water level, be closed or time out
|
||||
tx_event_group_val =
|
||||
xEventGroupWaitBits(spp_local_param.tx_event_group, SLOT_WRITE_BIT(serial) | SLOT_CLOSE_BIT(serial), pdTRUE,
|
||||
pdFALSE, VFS_WRITE_TIMEOUT / portTICK_PERIOD_MS);
|
||||
|
Loading…
x
Reference in New Issue
Block a user