mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
Process::create_user_process() shouldn't leak a process if exec() fails.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user