From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx> --- android/socket.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/android/socket.c b/android/socket.c index 03b6d6d..fe16e49 100644 --- a/android/socket.c +++ b/android/socket.c @@ -647,6 +647,12 @@ static void accept_cb(GIOChannel *io, GError *err, gpointer user_data) sock_acc = g_io_channel_unix_get_fd(io); rfsock_acc = create_rfsock(sock_acc, &hal_fd); + if (!rfsock_acc) { + g_io_channel_shutdown(io, TRUE, NULL); + g_io_channel_unref(io); + return; + } + connections = g_list_append(connections, rfsock_acc); DBG("rfsock: fd %d real_sock %d chan %u sock %d", @@ -905,8 +911,11 @@ static int handle_connect(void *buf) DBG(""); - android2bdaddr(cmd->bdaddr, &dst); rfsock = create_rfsock(-1, &hal_fd); + if (!rfsock) + return -1; + + android2bdaddr(cmd->bdaddr, &dst); bacpy(&rfsock->dst, &dst); memset(&uuid, 0, sizeof(uuid)); -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html