Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit eae8838

Browse files
committed
Fix memory leak in unit test.
The StringPool entries are destroyed with the allocator, the string pool itself is not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289207 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent f6da5c0 commit eae8838

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

unittests/DebugInfo/DWARF/DwarfGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ llvm::Error dwarfgen::Generator::init(Triple TheTriple, uint16_t V) {
203203
MC->setDwarfVersion(Version);
204204
Asm->setDwarfVersion(Version);
205205

206-
StringPool = new DwarfStringPool(Allocator, *Asm, StringRef());
206+
StringPool = llvm::make_unique<DwarfStringPool>(Allocator, *Asm, StringRef());
207207

208208
return Error::success();
209209
}

unittests/DebugInfo/DWARF/DwarfGenerator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ class Generator {
170170
MCStreamer *MS; // Owned by AsmPrinter
171171
std::unique_ptr<TargetMachine> TM;
172172
std::unique_ptr<AsmPrinter> Asm;
173-
DwarfStringPool *StringPool; // Owned by Allocator
174-
std::vector<std::unique_ptr<CompileUnit>> CompileUnits;
175173
BumpPtrAllocator Allocator;
174+
std::unique_ptr<DwarfStringPool> StringPool; // Entries owned by Allocator.
175+
std::vector<std::unique_ptr<CompileUnit>> CompileUnits;
176176
DIEAbbrevSet Abbreviations;
177177

178178
SmallString<4096> FileBytes;

0 commit comments

Comments
 (0)