diff options
Diffstat (limited to 'Userland/Utilities/disk_benchmark.cpp')
-rw-r--r-- | Userland/Utilities/disk_benchmark.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Utilities/disk_benchmark.cpp b/Userland/Utilities/disk_benchmark.cpp index ad3fa9d401..bb391a9fb8 100644 --- a/Userland/Utilities/disk_benchmark.cpp +++ b/Userland/Utilities/disk_benchmark.cpp @@ -95,7 +95,11 @@ int main(int argc, char** argv) if (block_size > file_size) continue; - auto buffer = ByteBuffer::create_uninitialized(block_size); + auto buffer_result = ByteBuffer::create_uninitialized(block_size); + if (!buffer_result.has_value()) { + warnln("Not enough memory to allocate space for block size = {}", block_size); + continue; + } Vector<Result> results; outln("Running: file_size={} block_size={}", file_size, block_size); @@ -104,7 +108,7 @@ int main(int argc, char** argv) while (timer.elapsed() < time_per_benchmark * 1000) { out("."); fflush(stdout); - auto result = benchmark(filename, file_size, block_size, buffer, allow_cache); + auto result = benchmark(filename, file_size, block_size, *buffer_result, allow_cache); if (!result.has_value()) return 1; results.append(result.release_value()); |