mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
Fix crash when process spawn fails.
This commit is contained in:
parent
c178d7a9e3
commit
8525cdd6a2
1 changed files with 5 additions and 2 deletions
|
@ -307,7 +307,8 @@ Task* Task::createUserTask(const String& path, uid_t uid, gid_t gid, pid_t paren
|
|||
};
|
||||
bool success = space.loadELF(move(elfData));
|
||||
if (!success) {
|
||||
MM.remove_kernel_alias_for_region(*region, region_alias);
|
||||
if (region)
|
||||
MM.remove_kernel_alias_for_region(*region, region_alias);
|
||||
delete t;
|
||||
kprintf("Failure loading ELF %s\n", path.characters());
|
||||
error = -ENOEXEC;
|
||||
|
@ -332,12 +333,14 @@ Task* Task::createUserTask(const String& path, uid_t uid, gid_t gid, pid_t paren
|
|||
t->m_tss.eip = (dword)space.symbolPtr("_start");
|
||||
if (!t->m_tss.eip) {
|
||||
// FIXME: This is ugly. If we need to do this, it should be at a different level.
|
||||
MM.remove_kernel_alias_for_region(*region, region_alias);
|
||||
if (region)
|
||||
MM.remove_kernel_alias_for_region(*region, region_alias);
|
||||
delete t;
|
||||
error = -ENOEXEC;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ASSERT(region);
|
||||
MM.remove_kernel_alias_for_region(*region, region_alias);
|
||||
|
||||
MM.mapRegionsForTask(*t);
|
||||
|
|
Loading…
Add table
Reference in a new issue