1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Fix a use after free.

llvm-svn: 312590
This commit is contained in:
Rafael Espindola 2017-09-05 23:00:51 +00:00
parent 60e97a1d60
commit 8948c6baa1

View File

@ -80,11 +80,11 @@ ELFDumper<ELFT>::getUniquedSectionName(const Elf_Shdr *Sec) {
if (!NameOrErr)
return NameOrErr;
StringRef Name = *NameOrErr;
std::string Ret = Name;
std::string &Ret = SectionNames[SecIndex];
Ret = Name;
while (!UsedSectionNames.insert(Ret).second)
Ret = (Name + to_string(++Suffix)).str();
SectionNames[SecIndex] = Ret;
return SectionNames[SecIndex];
return Ret;
}
template <class ELFT> ErrorOr<ELFYAML::Object *> ELFDumper<ELFT>::dump() {