Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Fix possible crash when removing disconnect watches
@ 2010-11-08 14:43 Luiz Augusto von Dentz
  2010-11-08 16:15 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2010-11-08 14:43 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

The callback may have remove itself before returning.
---
 src/device.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/device.c b/src/device.c
index c2b6682..7c421e3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -798,6 +798,10 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg)
 			data->watch(device, device->temporary,
 							data->user_data);
 
+		/* Check if the watch has been removed by callback function */
+		if (!g_slist_find(device->watches, data))
+			continue;
+
 		device->watches = g_slist_remove(device->watches, data);
 		g_free(data);
 	}
-- 
1.7.1


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

end of thread, other threads:[~2010-11-08 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-08 14:43 [PATCH] Fix possible crash when removing disconnect watches Luiz Augusto von Dentz
2010-11-08 16:15 ` Johan Hedberg

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