From b6845de3f6e448136c2b486c7d4cedda8c88956a Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Thu, 28 May 2020 17:49:46 +0300 Subject: [PATCH] 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. --- Kernel/Process.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index d6227c8fc0..68aadab1e6 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -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; }