[llvm-commits] [llvm] r109363 - /llvm/trunk/tools/bugpoint/ToolRunner.cpp
Rafael Espindola
rafael.espindola at gmail.com
Sat Jul 24 16:02:12 PDT 2010
Author: rafael
Date: Sat Jul 24 18:02:11 2010
New Revision: 109363
URL: http://llvm.org/viewvc/llvm-project?rev=109363&view=rev
Log:
Fix a trivial use after free.
Modified:
llvm/trunk/tools/bugpoint/ToolRunner.cpp
Modified: llvm/trunk/tools/bugpoint/ToolRunner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ToolRunner.cpp?rev=109363&r1=109362&r2=109363&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/ToolRunner.cpp (original)
+++ llvm/trunk/tools/bugpoint/ToolRunner.cpp Sat Jul 24 18:02:11 2010
@@ -719,7 +719,11 @@
return -1;
}
- std::vector<const char*> ProgramArgs;
+ std::vector<const char *> ProgramArgs;
+
+ // Declared here so that the destructor only runs after
+ // ProgramArgs is used.
+ std::string Exec;
if (RemoteClientPath.isEmpty())
ProgramArgs.push_back(OutputBinary.c_str());
@@ -741,7 +745,7 @@
// Full path to the binary. We need to cd to the exec directory because
// there is a dylib there that the exec expects to find in the CWD
char* env_pwd = getenv("PWD");
- std::string Exec = "cd ";
+ Exec = "cd ";
Exec += env_pwd;
Exec += "; ./";
Exec += OutputBinary.c_str();
More information about the llvm-commits
mailing list