From 995d19a8d42a01c66e15346f8ad2fc36f847fdf0 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Thu, 28 Nov 2013 16:38:03 +0200 Subject: [PATCH] android/hidhost: Shutdown ctrl_io channel if intr_io fails This fix possible memory leak. --- android/hidhost.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/hidhost.c b/android/hidhost.c index 50ac50dbc..44310ed32 100644 --- a/android/hidhost.c +++ b/android/hidhost.c @@ -1215,8 +1215,12 @@ bool bt_hid_register(const bdaddr_t *addr) BT_IO_OPT_INVALID); if (!intr_io) { error("Failed to listen on intr channel: %s", err->message); - g_io_channel_unref(ctrl_io); g_error_free(err); + + g_io_channel_shutdown(ctrl_io, TRUE, NULL); + g_io_channel_unref(ctrl_io); + ctrl_io = NULL; + return false; } -- 2.47.3