summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/DebugInfo
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2016-12-08 16:57:04 +0000
committerGreg Clayton <gclayton@apple.com>2016-12-08 16:57:04 +0000
commitb90328356a50f219af9d355943f7e1149bab22f2 (patch)
tree29af9b56ae39a82a50895ee11dd69aa68728c527 /llvm/unittests/DebugInfo
parent4737f941323c33305cc02ead13efc7e23ceadef1 (diff)
downloadbcm5719-llvm-b90328356a50f219af9d355943f7e1149bab22f2.tar.gz
bcm5719-llvm-b90328356a50f219af9d355943f7e1149bab22f2.zip
Fix ASAN buildbots by fixing a double free crash.
The dwarfgen::Generator::StringPool was in a unique_ptr but it was owned by the Allocator member variable so it was being free twice. llvm-svn: 289070
Diffstat (limited to 'llvm/unittests/DebugInfo')
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp6
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
index 06fa121e7a2..05039875729 100644
--- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
@@ -110,7 +110,9 @@ dwarfgen::DIE dwarfgen::CompileUnit::getUnitDIE() {
/// dwarfgen::Generator implementation.
//===----------------------------------------------------------------------===//
-dwarfgen::Generator::Generator() : Abbreviations(Allocator) {}
+dwarfgen::Generator::Generator()
+ : MAB(nullptr), MCE(nullptr), MS(nullptr), StringPool(nullptr),
+ Abbreviations(Allocator) {}
dwarfgen::Generator::~Generator() = default;
llvm::Expected<std::unique_ptr<dwarfgen::Generator>>
@@ -201,7 +203,7 @@ llvm::Error dwarfgen::Generator::init(Triple TheTriple, uint16_t V) {
MC->setDwarfVersion(Version);
Asm->setDwarfVersion(Version);
- StringPool.reset(new DwarfStringPool(Allocator, *Asm, StringRef()));
+ StringPool = new DwarfStringPool(Allocator, *Asm, StringRef());
return Error::success();
}
diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h
index 185bbecb91d..f3d2413be04 100644
--- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h
+++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h
@@ -170,7 +170,7 @@ class Generator {
MCStreamer *MS; // Owned by AsmPrinter
std::unique_ptr<TargetMachine> TM;
std::unique_ptr<AsmPrinter> Asm;
- std::unique_ptr<DwarfStringPool> StringPool;
+ DwarfStringPool *StringPool; // Owned by Allocator
std::vector<std::unique_ptr<CompileUnit>> CompileUnits;
BumpPtrAllocator Allocator;
DIEAbbrevSet Abbreviations;
OpenPOWER on IntegriCloud