mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
Process::create_user_process() shouldn't leak a process if exec() fails.
This commit is contained in:
parent
2f010e941c
commit
55c722096d
1 changed files with 3 additions and 1 deletions
|
@ -489,8 +489,10 @@ Process* Process::create_user_process(const String& path, uid_t uid, gid_t gid,
|
|||
auto* process = new Process(parts.takeLast(), uid, gid, parent_pid, Ring3, move(cwd), nullptr, tty);
|
||||
|
||||
error = process->exec(path, move(arguments), move(environment));
|
||||
if (error != 0)
|
||||
if (error != 0) {
|
||||
delete process;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ProcFS::the().add_process(*process);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue