Skip to content

Commit

Permalink
Resource leak: 'socket' never closed
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Rathgeb <[email protected]>
  • Loading branch information
maggu2810 committed Mar 10, 2015
1 parent 1780131 commit fcfdefe
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ public static boolean checkVitality(String host, int port, int timeout) throws I
}
else {
SocketAddress socketAddress = new InetSocketAddress(host, port);

Socket socket = new Socket();
socket.connect(socketAddress, timeout);

try (Socket socket = new Socket()) {
socket.connect(socketAddress, timeout);
}

success = true;
}
}
Expand Down

0 comments on commit fcfdefe

Please sign in to comment.