#fixed code
                              public void writeTo( Writer writer, WriterConfig config ) throws IOException {
    if( writer == null ) {
      throw new NullPointerException( "writer is null" );
    }
    if( config == null ) {
      throw new NullPointerException( "config is null" );
    }
    WritingBuffer buffer = new WritingBuffer( writer, 128 );
    write( config.createWriter( buffer ) );
    buffer.flush();
  }
#vulnerable code 
                              public void writeTo( Writer writer, WriterConfig config ) throws IOException {
    WritingBuffer buffer = new WritingBuffer( writer, 128 );
    write( config == null ? new JsonWriter( buffer ) : config.createWriter( buffer ) );
    buffer.flush();
  } 
                            #location 4 
                            #vulnerability type RESOURCE_LEAK