diff mbox series

[BlueZ,v3,3/3] shared/bap: Make bt_bap_ref_safe check if the instance is attached

Message ID 20240206223513.2783330-3-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 6dafe901a2bae49048968872e0854cc47cfec45b
Headers show
Series [BlueZ,v3,1/3] shared/bap: Rework stream procedures | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint fail WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 1: T1 Title exceeds max length (81>80): "[BlueZ,v3,3/3] shared/bap: Make bt_bap_ref_safe check if the instance is attached"
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz Feb. 6, 2024, 10:35 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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 mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 4722ed1a1b27..804352db9c41 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);