summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-04-30 19:37:46 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2008-04-30 19:37:46 +0000
commit2d5441331d402a0d78c4b84a028df076f6aab8cf (patch)
tree4088debc08f4551400c9788802bc8da0a6cb2035 /input
parentc13abd60b0fd396820fe8160b893e95df7ed286b (diff)
Fix possible memory leak when closing control channel.
Diffstat (limited to 'input')
-rw-r--r--input/device.c1
-rw-r--r--input/manager.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/input/device.c b/input/device.c
index 08a1c089..348622e6 100644
--- a/input/device.c
+++ b/input/device.c
@@ -580,6 +580,7 @@ static void interrupt_connect_cb(GIOChannel *chan, int err, gpointer user_data)
dbus_message_new_method_return(idev->pending_connect));
goto cleanup;
+
failed:
error_connection_attempt_failed(idev->conn,
idev->pending_connect, -err);
diff --git a/input/manager.c b/input/manager.c
index d7476cd7..9f8dcf66 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -62,7 +62,7 @@ struct pending_req {
DBusMessage *msg;
sdp_list_t *pnp_recs;
sdp_list_t *hid_recs;
- int ctrl_sock;
+ GIOChannel *ctrl_channel;
};
static GSList *device_paths = NULL; /* Input registered paths */
@@ -259,7 +259,8 @@ failed:
error_connection_attempt_failed(pr->conn, pr->msg, err);
cleanup:
- close(pr->ctrl_sock);
+ g_io_channel_close(pr->ctrl_channel);
+ g_io_channel_unref(pr->ctrl_channel);
g_io_channel_close(chan);
g_io_channel_unref(chan);
pending_req_free(pr);
@@ -278,7 +279,7 @@ static void control_connect_cb(GIOChannel *chan, int err, gpointer user_data)
}
/* Set HID control channel */
- pr->ctrl_sock = g_io_channel_unix_get_fd(chan);
+ pr->ctrl_channel = chan;
/* Connect to the HID interrupt channel */
err = bt_l2cap_connect(&pr->src, &pr->dst, L2CAP_PSM_HIDP_INTR,