output: #fixed code
                                  public static void main(String[] args) throws IOException, URISyntaxException {
  
          final OutputStream out = new BufferedOutputStream(new FileOutputStream(new File("/path/to/dump.rdb")));
          final RawByteListener rawByteListener = new RawByteListener() {
              @Override
              public void handle(byte... rawBytes) {
                  try {
                      out.write(rawBytes);
                  } catch (IOException ignore) {
                  }
              }
          };
  
          //save rdb from remote server
          Replicator replicator = new RedisReplicator("redis://127.0.0.1:6379");
          replicator.addRdbListener(new RdbListener() {
              @Override
              public void preFullSync(Replicator replicator) {
                  replicator.addRawByteListener(rawByteListener);
              }
  
              @Override
              public void handle(Replicator replicator, KeyValuePair<?> kv) {
              }
  
              @Override
              public void postFullSync(Replicator replicator, long checksum) {
                  replicator.removeRawByteListener(rawByteListener);
                  try {
                      out.close();
                      replicator.close();
                  } catch (IOException ignore) {
                  }
              }
          });
          replicator.open();
  
          //check rdb file
          replicator = new RedisReplicator("redis:///path/to/dump.rdb");
          replicator.addRdbListener(new RdbListener.Adaptor() {
              @Override
              public void handle(Replicator replicator, KeyValuePair<?> kv) {
                  System.out.println(kv);
              }
          });
          replicator.open();
      }
input: #vulnerable code 
                                  public static void main(String[] args) throws IOException {
  
          final FileOutputStream out = new FileOutputStream(new File("./src/test/resources/dump.rdb"));
          final RawByteListener rawByteListener = new RawByteListener() {
              @Override
              public void handle(byte... rawBytes) {
                  try {
                      out.write(rawBytes);
                  } catch (IOException ignore) {
                  }
              }
          };
  
          //save rdb from remote server
          Replicator replicator = new RedisReplicator("127.0.0.1", 6379, Configuration.defaultSetting());
          replicator.addRdbListener(new RdbListener() {
              @Override
              public void preFullSync(Replicator replicator) {
                  replicator.addRawByteListener(rawByteListener);
              }
  
              @Override
              public void handle(Replicator replicator, KeyValuePair<?> kv) {
              }
  
              @Override
              public void postFullSync(Replicator replicator, long checksum) {
                  replicator.removeRawByteListener(rawByteListener);
                  try {
                      out.close();
                      replicator.close();
                  } catch (IOException ignore) {
                  }
              }
          });
          replicator.open();
  
          //check rdb file
          replicator = new RedisReplicator(new File("./src/test/resources/dump.rdb"), FileType.RDB, Configuration.defaultSetting());
          replicator.addRdbListener(new RdbListener.Adaptor() {
              @Override
              public void handle(Replicator replicator, KeyValuePair<?> kv) {
                  System.out.println(kv);
              }
          });
          replicator.open();
      } 
                              #location 36 
                              #vulnerability type RESOURCE_LEAK