Skip to content

Commit

Permalink
Lib: fix socket leak when sockfd == 0
Browse files Browse the repository at this point in the history
amqp_open_socket_inner will leak the socket when sockfd == 0.

Caught by coverity, CID: 1383631
  • Loading branch information
alanxz committed Jan 10, 2018
1 parent abf4886 commit bcdf31e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion librabbitmq/amqp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ int amqp_open_socket_inner(char const *hostname, int portnumber,
for (addr = address_list; addr; addr = addr->ai_next) {
sockfd = connect_socket(addr, deadline);

if (sockfd > 0) {
if (sockfd >= 0) {
last_error = AMQP_STATUS_OK;
break;
} else if (sockfd == AMQP_STATUS_TIMEOUT) {
Expand Down

0 comments on commit bcdf31e

Please sign in to comment.