[PATCH] D33964: [LLVM][llvm-objcopy] Added basic plumbing to get things started
Michael Spencer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 15:20:56 PDT 2017
Bigcheese added inline comments.
================
Comment at: tools/llvm-objcopy/Object.cpp:171
+ Flags = Ehdr.e_flags;
+ SectionNames = new StringTableSection();
+ SectionNames->Name = ".shstrtab";
----------------
jakehehrlich wrote:
> Bigcheese wrote:
> > Memory leak. Use unique_ptr.
> It get's emplaced into the Sections vector first thing after allocation and that unique pointer manages the memory. Would be more obvious that a leak isn't occurring I first add a new unique pointer to Sections and then assign SectionNames via a cast from there?
Ah, I see now. It would probably be best to do:
```
Sections.push_back(make_unique<StringTableSection>());
SectionNames = Sections.back().get();
...
```
Repository:
rL LLVM
https://reviews.llvm.org/D33964
More information about the llvm-commits
mailing list