diff mbox series

[BlueZ,v1] avdtp: add NULL check to avdtp_has_stream()

Message ID 20240628150418.563987-1-r.smirnov@omp.ru
State New
Headers show
Series [BlueZ,v1] avdtp: add NULL check to avdtp_has_stream() | expand

Commit Message

Roman Smirnov June 28, 2024, 3:04 p.m. UTC
Make avdtp_has_stream() safe for passing NULL pointers.

Found with the SVACE static analysis tool.
---
 profiles/audio/avdtp.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 3667e0840..913298319 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -3918,6 +3918,9 @@  struct btd_device *avdtp_get_device(struct avdtp *session)
 
 gboolean avdtp_has_stream(struct avdtp *session, struct avdtp_stream *stream)
 {
+	if (!session)
+		return FALSE;
+
 	return g_slist_find(session->streams, stream) ? TRUE : FALSE;
 }