summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-06-06 14:17:47 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-06-06 14:17:47 +0000
commitf62f8d892b5d5cc5aedef83779671c1ed54a35da (patch)
treead61779f46488c240171a6d966e5954ae11c633e /hcid
parentdd368f19884b9751a0f99ffebcd2c5520069f5db (diff)
Fix path reference usage after freeing device object
Diffstat (limited to 'hcid')
-rw-r--r--hcid/device.c10
1 files 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)