Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/7] android/gatt: Unify destroy functions
@ 2014-03-26 17:00 Jakub Tyszkowski
  2014-03-26 17:00 ` [PATCH 2/7] android/gatt: Use better name for matching function Jakub Tyszkowski
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Jakub Tyszkowski @ 2014-03-26 17:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

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


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

end of thread, other threads:[~2014-03-27 15:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-26 17:00 [PATCH 1/7] android/gatt: Unify destroy functions Jakub Tyszkowski
2014-03-26 17:00 ` [PATCH 2/7] android/gatt: Use better name for matching function Jakub Tyszkowski
2014-03-26 17:00 ` [PATCH 3/7] android/gatt: Use better name for function filling element_id Jakub Tyszkowski
2014-03-26 17:00 ` [PATCH 4/7] android/gatt: Add helper for service search Jakub Tyszkowski
2014-03-26 17:00 ` [PATCH 5/7] android/gatt: Reduce callback data struct scope Jakub Tyszkowski
2014-03-26 17:00 ` [PATCH 6/7] android/gatt: Fix sendig wrong byte ordered uuids Jakub Tyszkowski
2014-03-27 15:26   ` Szymon Janc
2014-03-26 17:00 ` [PATCH 7/7] android/gatt: Fix cached services having element_id uuid not set Jakub Tyszkowski
2014-03-27 15:23 ` [PATCH 1/7] android/gatt: Unify destroy functions Szymon Janc

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