Skip to content

Commit

Permalink
Merge pull request openhab#157 from maggu2810/fix-resource-leak
Browse files Browse the repository at this point in the history
Resource leak: 'socket' never closed
  • Loading branch information
kaikreuzer committed Mar 10, 2015
2 parents 743bc6c + fcfdefe commit cc7fa1d
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 cc7fa1d

Please sign in to comment.