mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 05:08:56 +00:00
Kernel: Make InodeFile::create() API OOM safe
This commit is contained in:
committed by
Andreas Kling
parent
112393b38a
commit
11bd2002bb
@@ -14,9 +14,12 @@ class Inode;
|
||||
|
||||
class InodeFile final : public File {
|
||||
public:
|
||||
static NonnullRefPtr<InodeFile> create(NonnullRefPtr<Inode>&& inode)
|
||||
static KResultOr<NonnullRefPtr<InodeFile>> create(NonnullRefPtr<Inode>&& inode)
|
||||
{
|
||||
return adopt_ref(*new InodeFile(move(inode)));
|
||||
auto file = adopt_ref_if_nonnull(new InodeFile(move(inode)));
|
||||
if (!file)
|
||||
return ENOMEM;
|
||||
return file.release_nonnull();
|
||||
}
|
||||
|
||||
virtual ~InodeFile() override;
|
||||
|
||||
Reference in New Issue
Block a user