output: #fixed code
                                  @NotNull
      private WireStore acquireStore(final long cycle, final long epoch) {
          @NotNull final RollCycle rollCycle = builder.rollCycle();
          @NotNull final String cycleFormat = this.dateCache.formatFor(cycle);
          @NotNull final File cycleFile = new File(this.builder.path(), cycleFormat + SUFFIX);
          try {
  
              final File parentFile = cycleFile.getParentFile();
              if (parentFile != null && !parentFile.exists()) {
                  parentFile.mkdirs();
              }
  
              final WireType wireType = builder.wireType();
              final MappedBytes mappedBytes = mappedBytes(builder, cycleFile);
  
              //noinspection PointlessBitwiseExpression
              if (mappedBytes.compareAndSwapInt(0, Wires.NOT_INITIALIZED, Wires.META_DATA
                      | Wires.NOT_READY | Wires.UNKNOWN_LENGTH)) {
  
                  final SingleChronicleQueueStore wireStore = new
                          SingleChronicleQueueStore(rollCycle, wireType, mappedBytes, epoch);
  
                  final Bytes<?> bytes = mappedBytes.bytesForWrite().writePosition(4);
                  wireType.apply(bytes).getValueOut().typedMarshallable(wireStore);
  
                  final long length = bytes.writePosition();
                  wireStore.install(
                          length,
                          true,
                          cycle,
                          builder
                  );
  
                  mappedBytes.writeOrderedInt(0L, Wires.META_DATA | Wires.toIntU30(bytes.writePosition() - 4, "Delegate too large"));
                  return wireStore;
              } else {
                  long end = System.currentTimeMillis() + TIMEOUT;
                  while ((mappedBytes.readVolatileInt(0) & Wires.NOT_READY) == Wires.NOT_READY) {
                      if (System.currentTimeMillis() > end) {
                          throw new IllegalStateException("Timed out waiting for the header record to be ready in " + cycleFile);
                      }
  
                      Jvm.pause(1);
                  }
  
                  mappedBytes.readPosition(0);
                  mappedBytes.writePosition(mappedBytes.capacity());
                  final int len = Wires.lengthOf(mappedBytes.readVolatileInt());
                  final long length = mappedBytes.readPosition() + len;
                  mappedBytes.readLimit(length);
                  //noinspection unchecked
                  final WireStore wireStore = wireType.apply(mappedBytes).getValueIn().typedMarshallable();
                  wireStore.install(length, false, cycle, builder);
  
                  return wireStore;
              }
          } catch (FileNotFoundException e) {
              throw Jvm.rethrow(e);
          }
  
  
      }
input: #vulnerable code 
                                  @NotNull
      private WireStore acquireStore(final long cycle, final long epoch) {
          @NotNull final RollCycle rollCycle = builder.rollCycle();
          @NotNull final String cycleFormat = this.dateCache.formatFor(cycle);
          @NotNull final File cycleFile = new File(this.builder.path(), cycleFormat + SUFFIX);
          try {
  
              final File parentFile = cycleFile.getParentFile();
              if (parentFile != null && !parentFile.exists()) {
                  parentFile.mkdirs();
              }
  
              final WireType wireType = builder.wireType();
              final MappedBytes mappedBytes = mappedBytes(builder, cycleFile);
  
              //noinspection PointlessBitwiseExpression
              if (mappedBytes.compareAndSwapInt(0, Wires.NOT_INITIALIZED, Wires.META_DATA
                      | Wires.NOT_READY | Wires.UNKNOWN_LENGTH)) {
  
  
                  final SingleChronicleQueueStore wireStore = new
                          SingleChronicleQueueStore(rollCycle, wireType, mappedBytes, epoch);
  
                  final Bytes<?> bytes = mappedBytes.bytesForWrite().writePosition(4);
                  wireType.apply(bytes).getValueOut().typedMarshallable(wireStore);
  
                  final long length = bytes.writePosition();
                  final WiredBytes<WireStore> wiredBytes = new WiredBytes<>(wireType, mappedBytes, wireStore, length, true);
                  wiredBytes.delegate().install(
                          wiredBytes.headerLength(),
                          wiredBytes.headerCreated(),
                          cycle,
                          builder
                  );
  
                  mappedBytes.writeOrderedInt(0L, Wires.META_DATA | Wires.toIntU30(bytes.writePosition() - 4, "Delegate too large"));
                  return wiredBytes.delegate();
              } else {
                  long end = System.currentTimeMillis() + TIMEOUT;
                  while ((mappedBytes.readVolatileInt(0) & Wires.NOT_READY) == Wires.NOT_READY) {
                      if (System.currentTimeMillis() > end) {
                          throw new IllegalStateException("Timed out waiting for the header record to be ready in " + cycleFile);
                      }
  
                      Jvm.pause(1);
                  }
  
                  mappedBytes.readPosition(0);
                  mappedBytes.writePosition(mappedBytes.capacity());
                  final int len = Wires.lengthOf(mappedBytes.readVolatileInt());
                  final long length = mappedBytes.readPosition() + len;
                  mappedBytes.readLimit(length);
                  //noinspection unchecked
                  final WireStore wireStore = wireType.apply(mappedBytes).getValueIn().typedMarshallable();
  
                  final WiredBytes<WireStore> wiredBytes = new WiredBytes<>(wireType, mappedBytes, wireStore, length, false);
                  wiredBytes.delegate().install(
                          wiredBytes.headerLength(),
                          wiredBytes.headerCreated(),
                          cycle,
                          builder);
  
                  return wiredBytes.delegate();
              }
          } catch (FileNotFoundException e) {
              throw Jvm.rethrow(e);
          }
  
  
      } 
                              #location 37 
                              #vulnerability type RESOURCE_LEAK