mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 17:15:08 +00:00
Kernel: Make Thread::try_create API OOM safe
This commit is contained in:
parent
d07309a180
commit
112393b38a
1 changed files with 6 additions and 1 deletions
|
@ -41,7 +41,12 @@ KResultOr<NonnullRefPtr<Thread>> Thread::try_create(NonnullRefPtr<Process> proce
|
|||
if (!kernel_stack_region)
|
||||
return ENOMEM;
|
||||
kernel_stack_region->set_stack(true);
|
||||
return adopt_ref(*new Thread(move(process), kernel_stack_region.release_nonnull()));
|
||||
|
||||
auto thread = adopt_ref_if_nonnull(new Thread(move(process), kernel_stack_region.release_nonnull()));
|
||||
if (!thread)
|
||||
return ENOMEM;
|
||||
|
||||
return thread.release_nonnull();
|
||||
}
|
||||
|
||||
Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Region> kernel_stack_region)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue