diff mbox series

[BlueZ,v1] core: add NULL check to adapter_service_remove()

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

Commit Message

Roman Smirnov June 28, 2024, 7:47 a.m. UTC
Make adapter_service_remove() safe for passing NULL pointers.
---
 src/adapter.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index bdc5bf920..57e4dcd54 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1349,6 +1349,10 @@  int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
 void adapter_service_remove(struct btd_adapter *adapter, uint32_t handle)
 {
 	sdp_record_t *rec;
+	
+	if (!adapter)
+		return;
+
 	/*
 	 * If the controller does not support BR/EDR operation,
 	 * there is no point in trying to remote SDP records.