From 6dafe901a2bae49048968872e0854cc47cfec45b Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 6 Feb 2024 17:33:08 -0500 Subject: [PATCH] shared/bap: Make bt_bap_ref_safe check if the instance is attached This makes bt_bap_ref_safe check that bap instance is part of sessions list which means it is attached/valid. --- src/shared/bap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 4722ed1a1..804352db9 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1033,7 +1033,7 @@ static void stream_notify_metadata(struct bt_bap_stream *stream) static struct bt_bap *bt_bap_ref_safe(struct bt_bap *bap) { - if (!bap || !bap->ref_count) + if (!bap || !bap->ref_count || !queue_find(sessions, NULL, bap)) return NULL; return bt_bap_ref(bap); -- 2.47.3