mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
Kernel: Make Space::create API OOM safe
This commit is contained in:
parent
d570048c9e
commit
8fc6168f21
Notes:
sideshowbarker
2024-07-18 17:15:07 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/8fc6168f21c Pull-request: https://github.com/SerenityOS/serenity/pull/7520 Reviewed-by: https://github.com/supercomputer7
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
Reference in a new issue