diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index 0bafb05b7a1d7..96e27e6216628 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -260,6 +260,12 @@ class SubProcessFunctionExecutorImpl return AddMemDefError; pid_t ParentOrChildPID = fork(); + + if (ParentOrChildPID == -1) { + return make_error("Failed to create child process: " + + Twine(strerror(errno))); + } + if (ParentOrChildPID == 0) { // We are in the child process, close the write end of the pipe close(PipeFiles[1]);