diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index 3ee5432..d6028d1 100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
if (fcntl(fd, F_GETFD) < 0) {
error("bluetooth: fcntl(%d, F_GETFD): %s (%d)", fd,
strerror(errno), errno);
+ close(fd);
return invalid_args(msg);
}
io = g_io_channel_unix_new(fd);
- if (io == NULL)
+ if (io == NULL) {
+ close(fd);
return invalid_args(msg);
+ }
DBG("device %s", device);
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index be79a77..308e56d 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
{
sessions = g_slist_remove(sessions, os);
- if (os->io)
+ if (os->io) {
+ g_io_channel_shutdown(os->io, TRUE, NULL);
g_io_channel_unref(os->io);
+ }
if (os->obex)
g_obex_unref(os->obex);