Skip to content

Commit

Permalink
fixes double close
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvossel committed Jul 22, 2013
1 parent f14be87 commit c04e887
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ipc_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ qb_ipcc_us_connect(struct qb_ipcc_connection * c,
c->event.u.us.shared_data = shm_ptr + (2 * sizeof(struct ipc_us_control));

close(fd_hdr);
fd_hdr = -1;

res = qb_ipc_dgram_sock_connect(r->response, "response", "request",
r->max_msg_size, &c->request.u.us.sock);
Expand All @@ -418,7 +419,9 @@ qb_ipcc_us_connect(struct qb_ipcc_connection * c,
return 0;

cleanup_hdr:
close(fd_hdr);
if (fd_hdr >= 0) {
close(fd_hdr);
}
close(c->event.u.us.sock);
close(c->request.u.us.sock);
unlink(r->request);
Expand Down

0 comments on commit c04e887

Please sign in to comment.