1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 13:11:39 +01:00

Remove memory corruption bug. string.c_str() was returning a temporary that was

dead before we used it.

llvm-svn: 77304
This commit is contained in:
Nick Lewycky 2009-07-28 06:53:50 +00:00
parent 93c1b56fe9
commit 02a08fcbe5

View File

@ -409,7 +409,7 @@ void LTOModule::addPotentialUndefinedSymbol(GlobalValue* decl, Mangler &mangler)
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 @@ void LTOModule::addPotentialUndefinedSymbol(GlobalValue* decl, Mangler &mangler)
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