summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-07-24 23:02:11 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-07-24 23:02:11 +0000
commit97595eb05c28b25a7042d6fa1a2e0f3099506a1e (patch)
tree1f459ea39199c77bea1cb72c0f9d70afd34e33d3 /tools
parent13f03f0006a828c57e910001b00f6d022f3045d8 (diff)
downloadllvm-97595eb05c28b25a7042d6fa1a2e0f3099506a1e.tar.gz
llvm-97595eb05c28b25a7042d6fa1a2e0f3099506a1e.tar.bz2
llvm-97595eb05c28b25a7042d6fa1a2e0f3099506a1e.tar.xz
Fix a trivial use after free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109363 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/bugpoint/ToolRunner.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp
index 3149a7a494..df14aab3df 100644
--- a/tools/bugpoint/ToolRunner.cpp
+++ b/tools/bugpoint/ToolRunner.cpp
@@ -719,7 +719,11 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
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 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
// 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();