Diff between b04bec273ec37bca1a46ab5f85ef0529a3940337 and 251a2b3ca4d31391dbd08d966909290c090f244a

Changed Files

File Additions Deletions Status
obexd/plugins/bluetooth.c +4 -1 modified
obexd/src/obex.c +3 -1 modified

Full Patch

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
@@ -144,12 +144,15 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
 	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
@@ -235,8 +235,10 @@ static void obex_session_free(struct obex_session *os)
 {
 	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);