bluez5: backend-native: Free command list queue on RFComm free

When RFComm conection is closed or lost, the pending commands should
be freed, and if a DBus message is attached an error reply should be
sent.
This commit is contained in:
Frédéric Danis 2025-08-11 16:36:01 +02:00
parent 618d60a1f2
commit 1ad3fdff8a

View file

@ -411,12 +411,23 @@ static void volume_sync_stop_timer(struct rfcomm *rfcomm);
static void rfcomm_free(struct rfcomm *rfcomm)
{
struct updated_call *updated_call;
struct rfcomm_cmd *cmd;
spa_list_consume(updated_call, &rfcomm->updated_call_list, link) {
spa_list_remove(&updated_call->link);
free(updated_call);
}
spa_list_consume(cmd, &rfcomm->cmd_send_queue, link) {
if (cmd->msg) {
telephony_send_dbus_method_reply(rfcomm->backend->telephony, cmd->msg, BT_TELEPHONY_ERROR_FAILED, 0);
spa_clear_ptr(cmd->msg, dbus_message_unref);
}
spa_list_remove(&cmd->link);
free(cmd);
}
codec_switch_stop_timer(rfcomm);
if (rfcomm->telephony_ag) {
telephony_ag_destroy(rfcomm->telephony_ag);