[PATCH 1/7] android/gatt: Unify destroy functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch unifies destroy function names. We should also keep destroy
functions convention as it is in /src/shared/hci.c for example, and
check passed pointer before dereferencing it.
---
 android/gatt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 04e9729..aeb0585 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -96,10 +96,13 @@ static struct queue *conn_wait_queue = NULL;	/* Devs waiting to connect */
 
 static void bt_le_discovery_stop_cb(void);
 
-static void free_gatt_service(void *data)
+static void destroy_service(void *data)
 {
 	struct service *srvc = data;
 
+	if (!srvc)
+		return;
+
 	queue_destroy(srvc->chars, free);
 	free(srvc);
 }
@@ -175,8 +178,11 @@ static void destroy_device(void *data)
 {
 	struct gatt_device *dev = data;
 
+	if (!dev)
+		return;
+
 	queue_destroy(dev->clients, NULL);
-	queue_destroy(dev->services, free_gatt_service);
+	queue_destroy(dev->services, destroy_service);
 	free(dev);
 }
 
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux