summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-11-28 17:08:27 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-12-02 11:19:58 -0800
commit7280f4357cf6c72bf51ebe52739143e0b9203de2 (patch)
tree8af2ef153144cd9177ae7dc717d64e3407523877 /profiles
parent707a547e4d68fd4e848d349142746587de972039 (diff)
downloadbluez-7280f4357cf6c72bf51ebe52739143e0b9203de2.tar.gz
media: Fix crash when transport configuration changes
In case of BAP the same transport may be reconfigured multiple times which means it would appears multiple times on endpoint->transports leading to a crash when disconnecting as the code would attempt to destroy the same object multiple times.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/audio/media.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index c9328ab9b..6947cf963 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1057,6 +1057,8 @@ static int pac_config(struct bt_bap_stream *stream, struct iovec *cfg,
path = media_transport_get_path(transport);
bt_bap_stream_set_user_data(stream, (void *)path);
+ endpoint->transports = g_slist_append(endpoint->transports,
+ transport);
}
msg = dbus_message_new_method_call(endpoint->sender, endpoint->path,
@@ -1064,7 +1066,7 @@ static int pac_config(struct bt_bap_stream *stream, struct iovec *cfg,
"SetConfiguration");
if (msg == NULL) {
error("Couldn't allocate D-Bus message");
- media_transport_destroy(transport);
+ endpoint_remove_transport(endpoint, transport);
return FALSE;
}
@@ -1073,8 +1075,6 @@ static int pac_config(struct bt_bap_stream *stream, struct iovec *cfg,
data->cb = cb;
data->user_data = user_data;
- endpoint->transports = g_slist_append(endpoint->transports, transport);
-
dbus_message_iter_init_append(msg, &iter);
path = media_transport_get_path(transport);