Add an explicit initialization to work around what appears to be a valgrind
authorDaniel Dunbar <daniel@zuster.org>
Thu, 30 Sep 2010 23:56:49 +0000 (23:56 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 30 Sep 2010 23:56:49 +0000 (23:56 +0000)
false positive, at least on Darwin. I haven't filed this, but you can feel free.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115242 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Unix/Program.inc

index 0209f5aaf832d4c073baab61c24152a896c933bd..bbb029c4f3ecb6059ce6cc62cd74b5d47f724f1c 100644 (file)
@@ -212,7 +212,9 @@ Program::Execute(const Path &path, const char **args, const char **envp,
       envp = const_cast<const char **>(*_NSGetEnviron());
 #endif
 
-    pid_t PID;
+    // Explicitly initialized to prevent what appears to be a valgrind false
+    // positive.
+    pid_t PID = 0;
     int Err = posix_spawn(&PID, path.c_str(), &FileActions, /*attrp*/0,
                           const_cast<char **>(args), const_cast<char **>(envp));