[lld][MachO] Replace some std::string with char* buffers to eliminate mem leaks.
authorLang Hames <lhames@gmail.com>
Fri, 29 Jul 2016 20:04:18 +0000 (20:04 +0000)
committerLang Hames <lhames@gmail.com>
Fri, 29 Jul 2016 20:04:18 +0000 (20:04 +0000)
commit70c80b336b02a8e0f4d3f10a80787df111bee2b1
treeae854a24a3d23bebcee2b5daacb921aac019d94a
parenta6b68bf0b91cde70e085b22bc8840df2b8db7470
[lld][MachO] Replace some std::string with char* buffers to eliminate mem leaks.

The MachO debug support code (committed in r276935) occasionally needs to
allocate string copies, and was doing so by creating std::strings on a
BumpPtrAllocator. The strings were untracked, so the destructors weren't being
run and we were leaking the memory when the allocator was thrown away. Since
it's easier than tracking the strings, this patch switches the copies to char
buffers allocated directly in the bump-ptr allocator.

llvm-svn: 277208
lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp