Skip to contentSkip to conversation

Fix possible crash when removing disconnect watches

PATCH In review Luiz Augusto von Dentz 2 participants 2 messages Nov 8, 2010 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Fix possible crash when removing disconnect watches

From: Luiz Augusto von Dentz <[email protected]>

The callback may have remove itself before returning.

---
 src/device.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
src/device.c +4 -0
index c2b6682..7c421e3 100644
@@ -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);
 	}
Signature · 1 line
1.7.1
#1 lore raw

Hi Luiz,

Quoted 6 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

The callback may have remove itself before returning.

---
 src/device.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Pushed upstream. Thanks.

Johan