diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-06-06 14:17:47 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-06-06 14:17:47 +0000 |
commit | f62f8d892b5d5cc5aedef83779671c1ed54a35da (patch) | |
tree | ad61779f46488c240171a6d966e5954ae11c633e /hcid/device.c | |
parent | dd368f19884b9751a0f99ffebcd2c5520069f5db (diff) |
Fix path reference usage after freeing device object
Diffstat (limited to 'hcid/device.c')
-rw-r--r-- | hcid/device.c | 10 |
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) |