mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
Kernel: Replace make<T>() with adopt_own_if_nonnull() in sys$module_load
This commit is contained in:
parent
9ca8f0afaa
commit
51ceb172b9
1 changed files with 6 additions and 2 deletions
|
@ -37,13 +37,17 @@ KResultOr<int> Process::sys$module_load(Userspace<const char*> user_path, size_t
|
|||
auto storage = KBuffer::create_with_size(payload.size());
|
||||
memcpy(storage.data(), payload.data(), payload.size());
|
||||
|
||||
auto elf_image = make<ELF::Image>(storage.data(), storage.size());
|
||||
auto elf_image = adopt_own_if_nonnull(new ELF::Image(storage.data(), storage.size()));
|
||||
if (!elf_image)
|
||||
return ENOMEM;
|
||||
if (!elf_image->parse())
|
||||
return ENOEXEC;
|
||||
|
||||
HashMap<String, u8*> section_storage_by_name;
|
||||
|
||||
auto module = make<Module>();
|
||||
auto module = adopt_own_if_nonnull(new Module());
|
||||
if (!module)
|
||||
return ENOMEM;
|
||||
|
||||
elf_image->for_each_section_of_type(SHT_PROGBITS, [&](const ELF::Image::Section& section) {
|
||||
if (!section.size())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue