diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2009-07-28 06:53:50 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2009-07-28 06:53:50 +0000 |
commit | db1e9981b829ba57651dd8e13c0a960fde773209 (patch) | |
tree | 12c40c0f270b6bd9d0193ebfd97747c1dbff6384 /tools/lto | |
parent | 542383d93b146e11a1d70c01f8afea8ea9f08eff (diff) | |
download | external_llvm-db1e9981b829ba57651dd8e13c0a960fde773209.zip external_llvm-db1e9981b829ba57651dd8e13c0a960fde773209.tar.gz external_llvm-db1e9981b829ba57651dd8e13c0a960fde773209.tar.bz2 |
Remove memory corruption bug. string.c_str() was returning a temporary that was
dead before we used it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r-- | tools/lto/LTOModule.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index cbccfbb..4a2c5ad 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -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 |