#fixed code
                              @Override
  public ServiceMessage decodeData(ServiceMessage message, Class type) {
    if (message.data() != null && message.data() instanceof ByteBuf) {
      try (ByteBufInputStream inputStream = new ByteBufInputStream(message.data(), true)) {
        return ServiceMessage.from(message).data(readFrom(inputStream, type)).build();
      } catch (Throwable ex) {
        LOGGER.error("Failed to deserialize data", ex);
      }
    }
    return message;
  }
#vulnerable code 
                              @Override
  public ServiceMessage decodeData(ServiceMessage message, Class type) {
    if (message.data() != null && message.data() instanceof ByteBuf) {
      ByteBufInputStream inputStream = new ByteBufInputStream(message.data());
      try {
        return ServiceMessage.from(message).data(readFrom(inputStream, type)).build();
      } catch (Throwable ex) {
        LOGGER.error("Failed to deserialize data", ex);
      }
    }
    return message;
  } 
                            #location 6 
                            #vulnerability type RESOURCE_LEAK