public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] profile: add NULL check to ext_remove_records()
@ 2024-06-27  9:16 Roman Smirnov
  2024-06-27 11:08 ` [BlueZ] " bluez.test.bot
  2024-06-27 18:33 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-06-27  9:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

Add a NULL check to prevent dereferencing a null pointer in
case the adapter is NULL
---
 src/profile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/profile.c b/src/profile.c
index c62224af9..bb988e8cb 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -1507,7 +1507,8 @@ static void ext_remove_records(struct ext_profile *ext,
 
 		ext->records = g_slist_remove(ext->records, r);
 
-		adapter_service_remove(adapter, r->handle);
+		if (adapter)
+			adapter_service_remove(adapter, r->handle);
 		btd_adapter_unref(r->adapter);
 		g_free(r);
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-27 18:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27  9:16 [PATCH BlueZ] profile: add NULL check to ext_remove_records() Roman Smirnov
2024-06-27 11:08 ` [BlueZ] " bluez.test.bot
2024-06-27 18:33 ` [PATCH BlueZ] " Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox