diff --git a/src/device.c b/src/device.c
index fa5764e..d567952 100644
--- a/src/device.c
+++ b/src/device.c
DBusConnection *conn;
DBusMessage *msg;
GAttrib *attrib;
- GIOChannel *io;
struct btd_device *device;
GSList *match_uuids;
GSList *profiles_added;
if (req->records)
sdp_list_free(req->records, (sdp_free_func_t) sdp_record_free);
- if (req->io) {
+ if (req->attrib)
g_attrib_unref(req->attrib);
- g_io_channel_unref(req->io);
- g_io_channel_shutdown(req->io, FALSE, NULL);
- }
g_free(req);
}
}
req->attrib = g_attrib_new(io);
+ g_io_channel_unref(io);
+
gatt_discover_primary(req->attrib, NULL, primary_cb, req);
}
struct btd_adapter *adapter = device->adapter;
struct browse_req *req;
BtIOSecLevel sec_level;
+ GIOChannel *io;
bdaddr_t src;
if (device->browse)
sec_level = secure ? BT_IO_SEC_HIGH : BT_IO_SEC_LOW;
- req->io = bt_io_connect(BT_IO_L2CAP, gatt_connect_cb, req, NULL, NULL,
+ io = bt_io_connect(BT_IO_L2CAP, gatt_connect_cb, req, NULL, NULL,
BT_IO_OPT_SOURCE_BDADDR, &src,
BT_IO_OPT_DEST_BDADDR, &device->bdaddr,
BT_IO_OPT_CID, GATT_CID,
BT_IO_OPT_SEC_LEVEL, sec_level,
BT_IO_OPT_INVALID);
- if (req->io == NULL ) {
+ if (io == NULL ) {
browse_request_free(req);
return -EIO;
}