diff mbox series

[BlueZ] profile: add NULL check to ext_remove_records()

Message ID 20240627091628.46304-1-r.smirnov@omp.ru
State New
Headers show
Series [BlueZ] profile: add NULL check to ext_remove_records() | expand

Commit Message

Roman Smirnov June 27, 2024, 9:16 a.m. UTC
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 mbox series

Patch

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);
 	}