[llvm-commits] [llvm] r77304 - /llvm/trunk/tools/lto/LTOModule.cpp
Nick Lewycky
nicholas at mxc.ca
Mon Jul 27 23:53:50 PDT 2009
Author: nicholas
Date: Tue Jul 28 01:53:50 2009
New Revision: 77304
URL: http://llvm.org/viewvc/llvm-project?rev=77304&view=rev
Log:
Remove memory corruption bug. string.c_str() was returning a temporary that was
dead before we used it.
Modified:
llvm/trunk/tools/lto/LTOModule.cpp
Modified: llvm/trunk/tools/lto/LTOModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOModule.cpp?rev=77304&r1=77303&r2=77304&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOModule.cpp (original)
+++ llvm/trunk/tools/lto/LTOModule.cpp Tue Jul 28 01:53:50 2009
@@ -409,7 +409,7 @@
if (isa<GlobalAlias>(decl))
return;
- const char* name = mangler.getMangledName(decl).c_str();
+ std::string name = mangler.getMangledName(decl);
// we already have the symbol
if (_undefines.find(name) != _undefines.end())
@@ -417,7 +417,7 @@
NameAndAttributes info;
// string is owned by _undefines
- info.name = ::strdup(name);
+ info.name = ::strdup(name.c_str());
if (decl->hasExternalWeakLinkage())
info.attributes = LTO_SYMBOL_DEFINITION_WEAKUNDEF;
else
More information about the llvm-commits
mailing list