#vulnerable code 
                                private void sendMessage(String ircCatHost, int ircCatPort, String message, String channel) throws IOException {
        Socket socket = new Socket(ircCatHost, ircCatPort);
        Writer out = new OutputStreamWriter(socket.getOutputStream());
        try {
            out.write(format("%s %s\n", channel, message));
            out.flush();
        } catch (IOException e) {
            Closeables.closeQuietly(out);
            socket.close();
        }
    } 
                            #location 10 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                private void sendMessage(String ircCatHost, int ircCatPort, String message, String channel) throws IOException {
        Socket socket = new Socket(ircCatHost, ircCatPort);
        Closer closer = Closer.create();
        try {
            Writer out = closer.register(new OutputStreamWriter(socket.getOutputStream()));
            out.write(format("%s %s\n", channel, message));
            out.flush();
        } catch (IOException e) {
            socket.close();
            throw closer.rethrow(e);
        } finally {
            closer.close();
        }
    }