Fix bug where freed std::string memory would sometimes still be accessed.

This commit is contained in:
Matt Pharr
2011-11-24 20:45:51 -08:00
parent 5828f7da07
commit 15a7d353ab

View File

@@ -75,7 +75,7 @@ Target::GetTarget(const char *arch, const char *cpu, const char *isa,
if (cpu == NULL) {
std::string hostCPU = llvm::sys::getHostCPUName();
if (hostCPU.size() > 0)
cpu = hostCPU.c_str();
cpu = strdup(hostCPU.c_str());
else {
fprintf(stderr, "Warning: unable to determine host CPU!\n");
cpu = "generic";