From 1ad3fdff8a377a6e10532a8b0530765a4b472333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= Date: Mon, 11 Aug 2025 16:36:01 +0200 Subject: [PATCH] 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. --- spa/plugins/bluez5/backend-native.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spa/plugins/bluez5/backend-native.c b/spa/plugins/bluez5/backend-native.c index af62887a3..d4b5beef6 100644 --- a/spa/plugins/bluez5/backend-native.c +++ b/spa/plugins/bluez5/backend-native.c @@ -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);