Kernel: Make CoreDump::create API OOM safe

This commit is contained in:
Brian Gianforcaro 2021-05-28 05:04:18 -07:00 committed by Andreas Kling
parent 32f96eb937
commit d570048c9e

View file

@ -32,7 +32,7 @@ OwnPtr<CoreDump> CoreDump::create(NonnullRefPtr<Process> process, const String&
auto fd = create_target_file(process, output_path);
if (!fd)
return {};
return adopt_own(*new CoreDump(move(process), fd.release_nonnull()));
return adopt_own_if_nonnull(new CoreDump(move(process), fd.release_nonnull()));
}
CoreDump::CoreDump(NonnullRefPtr<Process> process, NonnullRefPtr<FileDescription>&& fd)