Kernel: Fix error case in Process::create_user_process()

If we fail to exec() the target executable, don't leak the thread (this actually
triggers an assertion when destructing the process), and print an error message.
This commit is contained in:
Sergey Bugaev 2020-05-28 17:49:46 +03:00 committed by Andreas Kling
commit b6845de3f6
Notes: sideshowbarker 2024-07-19 06:01:00 +09:00

View file

@ -1345,6 +1345,8 @@ Process* Process::create_user_process(Thread*& first_thread, const String& path,
error = process->exec(path, move(arguments), move(environment));
if (error != 0) {
dbg() << "Failed to exec " << path << ": " << error;
delete first_thread;
delete process;
return nullptr;
}