Skip to content

Commit

Permalink
Low: ipc_socket: Fixes fd leak in socket ipc client disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvossel committed Sep 16, 2013
1 parent e166f88 commit b327dbe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/ipc_shm.c
Expand Up @@ -39,6 +39,7 @@
static void
qb_ipcc_shm_disconnect(struct qb_ipcc_connection *c)
{
qb_ipcc_us_sock_close(c->setup.u.us.sock);
if (c->is_connected) {
qb_rb_close(c->request.u.shm.rb);
qb_rb_close(c->response.u.shm.rb);
Expand Down
5 changes: 3 additions & 2 deletions lib/ipc_socket.c
Expand Up @@ -281,8 +281,9 @@ qb_ipcc_us_disconnect(struct qb_ipcc_connection *c)
{
munmap(c->request.u.us.shared_data, SHM_CONTROL_SIZE);
unlink(c->request.u.us.shared_file_name);
close(c->request.u.us.sock);
close(c->event.u.us.sock);
qb_ipcc_us_sock_close(c->event.u.us.sock);
qb_ipcc_us_sock_close(c->request.u.us.sock);
qb_ipcc_us_sock_close(c->setup.u.us.sock);
}

static ssize_t
Expand Down
1 change: 0 additions & 1 deletion lib/ipcc.c
Expand Up @@ -383,7 +383,6 @@ qb_ipcc_disconnect(struct qb_ipcc_connection *c)

ow = _event_sock_one_way_get(c);
(void)_check_connection_state_with(c, -EAGAIN, ow, 0, POLLIN);
qb_ipcc_us_sock_close(ow->u.us.sock);

if (c->funcs.disconnect) {
c->funcs.disconnect(c);
Expand Down

0 comments on commit b327dbe

Please sign in to comment.