From 0cb8a70adca2ba3cb5f5d05ce17540564cc7a6d4 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Sat, 10 Sep 2016 01:42:43 +0000 Subject: [PATCH] [ELF] Fix memory leak in BinaryFile handling. llvm-svn: 281129 --- lld/ELF/SymbolTable.cpp | 1 + lld/ELF/SymbolTable.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index 74892075a153..baeb99d46946 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -55,6 +55,7 @@ void SymbolTable::addFile(std::unique_ptr File) { // Binary file if (auto *F = dyn_cast(FileP)) { + BinaryFiles.emplace_back(cast(File.release())); addFile(F->createELF()); return; } diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index 8a7bba16eccf..f8d601c4b759 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -127,6 +127,7 @@ private: // The symbol table owns all file objects. std::vector> ArchiveFiles; + std::vector> BinaryFiles; std::vector>> ObjectFiles; std::vector> LazyObjectFiles; std::vector>> SharedFiles;