Skip to content

Commit

Permalink
Merge pull request #167 from gao-yan/ipc-fd-memory-leaks
Browse files Browse the repository at this point in the history
Fix: ipc: Prevent fd and memory leaks in handle_new_connection()
  • Loading branch information
chrissie-c committed Jan 8, 2016
2 parents 32f782d + f5fd0c9 commit 3245d7a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/ipc_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,14 @@ handle_new_connection(struct qb_ipcs_service *s,
"Error in connection setup (%s)",
c->description);
}
qb_ipcs_disconnect(c);

if (c->state == QB_IPCS_CONNECTION_INACTIVE) {
/* This removes the initial alloc ref */
qb_ipcs_connection_unref(c);
qb_ipcc_us_sock_close(sock);
} else {
qb_ipcs_disconnect(c);
}
}
return res;
}
Expand Down

0 comments on commit 3245d7a

Please sign in to comment.