Skip to content

Commit

Permalink
plugins: Fix resource leak in connect_socket()
Browse files Browse the repository at this point in the history
Close the fd when the connect() fails.

Reported-by: Euler Robot <[email protected]>
Signed-off-by: Alex Chen <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
Alex Chen authored and stsquad committed Nov 16, 2020
1 parent b50ea0d commit dbb864b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions contrib/plugins/lockstep.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ static bool connect_socket(const char *path)

if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) {
perror("failed to connect");
close(fd);
return false;
}

Expand Down

0 comments on commit dbb864b

Please sign in to comment.