1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

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
parent 6627c3ea3a
commit b6845de3f6

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;
}