Kernel: Make KBuffer APIs OOM safe
This commit is contained in:
parent
864b1a65e3
commit
f4d7151c3c
Notes:
sideshowbarker
2024-07-18 17:15:23 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/f4d7151c3ca Pull-request: https://github.com/SerenityOS/serenity/pull/7520 Reviewed-by: https://github.com/supercomputer7
1 changed files with 2 additions and 2 deletions
|
@ -109,7 +109,7 @@ public:
|
|||
auto impl = KBufferImpl::try_create_with_size(size, access, name, strategy);
|
||||
if (!impl)
|
||||
return {};
|
||||
return adopt_own(*new KBuffer(impl.release_nonnull()));
|
||||
return adopt_own_if_nonnull(new KBuffer(impl.release_nonnull()));
|
||||
}
|
||||
|
||||
[[nodiscard]] static OwnPtr<KBuffer> try_create_with_bytes(ReadonlyBytes bytes, Region::Access access = Region::Access::Read | Region::Access::Write, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve)
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
auto impl = KBufferImpl::try_create_with_bytes(bytes, access, name, strategy);
|
||||
if (!impl)
|
||||
return {};
|
||||
return adopt_own(*new KBuffer(impl.release_nonnull()));
|
||||
return adopt_own_if_nonnull(new KBuffer(impl.release_nonnull()));
|
||||
}
|
||||
|
||||
[[nodiscard]] static KBuffer create_with_size(size_t size, Region::Access access = Region::Access::Read | Region::Access::Write, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve)
|
||||
|
|
Loading…
Add table
Reference in a new issue