UF.SOCK
UF (Use Freed) issues are reported when there is an attempt to use resources after they were released. The UF.SOCK warning indicates an attempt to use a socket after it was closed.
Example 1
Copy
private Socket s;
private void message(final Socket s, final String message) {
try {
s.getOutputStream().write(message.getBytes());
} catch (IOException e) {
try {
s.close();
} catch (IOException e1) {
//ignore
}
}
}
public void handshake() {
message(s, "hello");
}
public void requestData(final String key) throws IOException {
handshake();
message(s, "get_data[" + key + ']');
}
UF.SOCK is reported for the snippet on line 36: if an IOExcpetion is thrown on line 20, then 'socket' will be closed on line 23. However, the method 'message' called on line 36 will attempt to write into the socket whether it was closed or not.