1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

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
This commit is contained in:
Greg Clayton 2016-12-08 16:57:04 +00:00
parent f8337108d2
commit c1ee2b7cbe
2 changed files with 5 additions and 3 deletions

View File

@ -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();
}

View File

@ -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;