* [PATCH] Fix segfault when removing device
@ 2011-04-25 18:48 Bruna Moreira
2011-04-26 20:26 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Bruna Moreira @ 2011-04-25 18:48 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
The device_register_services() function uses g_slist_concat(), therefore
the passed list should not be freed. The primary_cb() function from GATT
library was freeing the services list using discover_primary_free(). To
fix this, the device_register_services() function receives a copy of
services list if called from inside a gatt_discover_primary() callback.
---
src/device.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/device.c b/src/device.c
index 44bf76f..72774bf 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1600,7 +1600,7 @@ static void primary_cb(GSList *services, guint8 status, gpointer user_data)
device_probe_drivers(device, uuids);
- device_register_services(req->conn, device, services, -1);
+ device_register_services(req->conn, device, g_slist_copy(services), -1);
g_slist_free(uuids);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix segfault when removing device
2011-04-25 18:48 [PATCH] Fix segfault when removing device Bruna Moreira
@ 2011-04-26 20:26 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-04-26 20:26 UTC (permalink / raw)
To: Bruna Moreira; +Cc: linux-bluetooth
Hi Bruna,
On Mon, Apr 25, 2011, Bruna Moreira wrote:
> The device_register_services() function uses g_slist_concat(), therefore
> the passed list should not be freed. The primary_cb() function from GATT
> library was freeing the services list using discover_primary_free(). To
> fix this, the device_register_services() function receives a copy of
> services list if called from inside a gatt_discover_primary() callback.
> ---
> src/device.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-26 20:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-25 18:48 [PATCH] Fix segfault when removing device Bruna Moreira
2011-04-26 20:26 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox