From f62f8d892b5d5cc5aedef83779671c1ed54a35da Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 6 Jun 2008 14:17:47 +0000 Subject: Fix path reference usage after freeing device object --- hcid/device.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hcid/device.c b/hcid/device.c index 423f35a6..f24b98b1 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -748,8 +748,10 @@ static void device_free(gpointer user_data) if (device->agent) agent_destroy(device->agent, FALSE); + g_slist_foreach(device->uuids, (GFunc) g_free, NULL); g_slist_free(device->uuids); + g_free(device->address); g_free(device->path); g_free(device); @@ -1050,9 +1052,13 @@ struct device *device_create(DBusConnection *conn, struct adapter *adapter, void device_remove(DBusConnection *conn, struct device *device) { - debug("Removing device %s", device->path); + gchar *path = g_strdup(device->path); + + debug("Removing device %s", path); + + g_dbus_unregister_interface(conn, path, DEVICE_INTERFACE); - g_dbus_unregister_interface(conn, device->path, DEVICE_INTERFACE); + g_free(path); } gint device_address_cmp(struct device *device, const gchar *address) -- cgit