From 15a7d353abe851bea5f604bd2337c7da09e76fad Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Thu, 24 Nov 2011 20:45:51 -0800 Subject: [PATCH] Fix bug where freed std::string memory would sometimes still be accessed. --- ispc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ispc.cpp b/ispc.cpp index 73fe446a..65dc0b67 100644 --- a/ispc.cpp +++ b/ispc.cpp @@ -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";