diff --git a/kernel/src/memory/Heap.cpp b/kernel/src/memory/Heap.cpp index ceb96406..f8fd6210 100644 --- a/kernel/src/memory/Heap.cpp +++ b/kernel/src/memory/Heap.cpp @@ -368,14 +368,16 @@ void dump_heap_usage() void* operator new(usize size) { - return kmalloc(size).expect_release_value("FIXME: Kernel new panics on OOM, since there are no exceptions. If " - "possible, use make for error propagation."); + auto rc = kmalloc(size); + if (rc.has_error()) { expect(false, rc.error_string()); } + return rc.release_value(); } void* operator new[](usize size) { - return kmalloc(size).expect_release_value("FIXME: Kernel new[] panics on OOM, since there are no exceptions. If " - "possible, use make for error propagation."); + auto rc = kmalloc(size); + if (rc.has_error()) { expect(false, rc.error_string()); } + return rc.release_value(); } void operator delete(void* p)