Diff between a84aa0e6e5e7cd94804386eaf09d430d1cf8e692 and 49b8c5901584eab77af40f8ad19779747b4506d6

Changed Files

File Additions Deletions Status
profiles/audio/media.c +16 -5 modified

Full Patch

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index a7fa85d..c9328ab 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -1440,7 +1440,7 @@ static DBusMessage *register_endpoint(DBusConnection *conn, DBusMessage *msg,
 	gboolean delay_reporting = FALSE;
 	uint8_t codec = 0;
 	struct bt_bap_pac_qos qos = {};
-	uint8_t *capabilities;
+	uint8_t *capabilities = NULL;
 	int size = 0;
 	int err;
 
@@ -3005,14 +3005,25 @@ static const GDBusPropertyTable media_properties[] = {
 static void path_free(void *data)
 {
 	struct media_adapter *adapter = data;
+	GSList *l;
 
 	queue_destroy(adapter->apps, app_free);
 
-	while (adapter->endpoints)
-		release_endpoint(adapter->endpoints->data);
+	for (l = adapter->endpoints; l;) {
+		struct media_endpoint *endpoint	= l->data;
+
+		l = g_slist_next(l);
+
+		release_endpoint(endpoint);
+	}
+
+	for (l = adapter->players; l;) {
+		struct media_player *mp = l->data;
+
+		l = g_slist_next(l);
 
-	while (adapter->players)
-		media_player_destroy(adapter->players->data);
+		media_player_destroy(mp);
+	}
 
 	adapters = g_slist_remove(adapters, adapter);