diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-11-29 19:14:11 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-11-29 19:14:11 +0000 |
commit | 596e474101ea9a8ecac9d8ee090d31469dbcc61d (patch) | |
tree | eec9884b2a00a762193158acf7994abd9b361b07 /include/llvm/Object | |
parent | 90d0e7e8be2dea641ca40ba86c14c08d429e5e76 (diff) |
Fix a memory leak in MachOObjectFile.
MachOObjectFile owns a MachOObj, but never frees it. Both MachOObjectFile
and MachOObj want to own the MemoryBuffer, though, so we have to be careful
and give them each one of their own.
Thanks to Greg Clayton, Eric Christopher and Michael Spencer for helping
figure out what's going wrong here.
rdar://12561773
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object')
-rw-r--r-- | include/llvm/Object/MachO.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index 4e03daab16..50c577dc26 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -44,7 +44,7 @@ public: virtual unsigned getArch() const; virtual StringRef getLoadName() const; - MachOObject *getObject() { return MachOObj; } + MachOObject *getObject() { return MachOObj.get(); } static inline bool classof(const Binary *v) { return v->isMachO(); @@ -104,7 +104,7 @@ protected: virtual error_code getLibraryPath(DataRefImpl LibData, StringRef &Res) const; private: - MachOObject *MachOObj; + OwningPtr<MachOObject> MachOObj; mutable uint32_t RegisteredStringTable; typedef SmallVector<DataRefImpl, 1> SectionList; SectionList Sections; |