1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 11:44:58 +00:00

Kernel: Make Inode::set_shared_vmobject() OOM-fallible

Allocating a WeakPtr can fail, so this let's us properly propagate said
failure.
This commit is contained in:
Idan Horowitz 2022-02-14 01:46:34 +02:00 committed by Andreas Kling
parent c620f18d8c
commit e37e4a7980
3 changed files with 5 additions and 4 deletions

View file

@ -18,7 +18,7 @@ ErrorOr<NonnullRefPtr<SharedInodeVMObject>> SharedInodeVMObject::try_create_with
auto new_physical_pages = TRY(VMObject::try_create_physical_pages(size));
auto dirty_pages = TRY(Bitmap::try_create(new_physical_pages.size(), false));
auto vmobject = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) SharedInodeVMObject(inode, move(new_physical_pages), move(dirty_pages))));
vmobject->inode().set_shared_vmobject(*vmobject);
TRY(vmobject->inode().set_shared_vmobject(*vmobject));
return vmobject;
}