[PATCH 4/9] android/bluetooth: Free devices on service unregister

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

 



There is no need to keep devices list in memory if service was
unregistered.
---
 android/bluetooth.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index e32ddd6..d6cefb7 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -154,6 +154,13 @@ static struct device *create_device(const bdaddr_t *bdaddr)
 	return dev;
 }
 
+static void free_device(struct device *dev)
+{
+	g_free(dev->name);
+	g_free(dev->friendly_name);
+	g_free(dev);
+}
+
 static struct device *get_device(const bdaddr_t *bdaddr)
 {
 	struct device *dev;
@@ -2557,5 +2564,8 @@ void bt_bluetooth_unregister(void)
 {
 	DBG("");
 
+	g_slist_free_full(devices, (GDestroyNotify) free_device);
+	devices = NULL;
+
 	ipc_unregister(HAL_SERVICE_ID_CORE);
 }
-- 
1.8.3.2

--
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