mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
Kernel: Make Space::create API OOM safe
This commit is contained in:
parent
d570048c9e
commit
8fc6168f21
1 changed files with 3 additions and 1 deletions
|
@ -20,7 +20,9 @@ OwnPtr<Space> Space::create(Process& process, const Space* parent)
|
|||
auto page_directory = PageDirectory::create_for_userspace(parent ? &parent->page_directory().range_allocator() : nullptr);
|
||||
if (!page_directory)
|
||||
return {};
|
||||
auto space = adopt_own(*new Space(process, page_directory.release_nonnull()));
|
||||
auto space = adopt_own_if_nonnull(new Space(process, page_directory.release_nonnull()));
|
||||
if (!space)
|
||||
return {};
|
||||
space->page_directory().set_space({}, *space);
|
||||
return space;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue