Fix bug where freed std::string memory would sometimes still be accessed.
This commit is contained in:
2
ispc.cpp
2
ispc.cpp
@@ -75,7 +75,7 @@ Target::GetTarget(const char *arch, const char *cpu, const char *isa,
|
|||||||
if (cpu == NULL) {
|
if (cpu == NULL) {
|
||||||
std::string hostCPU = llvm::sys::getHostCPUName();
|
std::string hostCPU = llvm::sys::getHostCPUName();
|
||||||
if (hostCPU.size() > 0)
|
if (hostCPU.size() > 0)
|
||||||
cpu = hostCPU.c_str();
|
cpu = strdup(hostCPU.c_str());
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Warning: unable to determine host CPU!\n");
|
fprintf(stderr, "Warning: unable to determine host CPU!\n");
|
||||||
cpu = "generic";
|
cpu = "generic";
|
||||||
|
|||||||
Reference in New Issue
Block a user