1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-08 12:27:35 +00:00

Kernel: Make PrivateInodeVMObject factory APIs OOM safe

This commit is contained in:
Brian Gianforcaro 2021-05-28 03:18:07 -07:00 committed by Andreas Kling
parent d947253c51
commit 65d5f81afc
4 changed files with 13 additions and 8 deletions

View file

@ -9,14 +9,14 @@
namespace Kernel {
NonnullRefPtr<PrivateInodeVMObject> PrivateInodeVMObject::create_with_inode(Inode& inode)
RefPtr<PrivateInodeVMObject> PrivateInodeVMObject::create_with_inode(Inode& inode)
{
return adopt_ref(*new PrivateInodeVMObject(inode, inode.size()));
return adopt_ref_if_nonnull(new PrivateInodeVMObject(inode, inode.size()));
}
RefPtr<VMObject> PrivateInodeVMObject::clone()
{
return adopt_ref(*new PrivateInodeVMObject(*this));
return adopt_ref_if_nonnull(new PrivateInodeVMObject(*this));
}
PrivateInodeVMObject::PrivateInodeVMObject(Inode& inode, size_t size)