[lld] r256309 - Fix two asan found bugs:
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 22 17:06:39 PST 2015
Author: rafael
Date: Tue Dec 22 19:06:39 2015
New Revision: 256309
URL: http://llvm.org/viewvc/llvm-project?rev=256309&view=rev
Log:
Fix two asan found bugs:
We were leaking InputFile subclasses data.
UndefinedElf was missing a classof.
Modified:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/InputFiles.h
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=256309&r1=256308&r2=256309&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Dec 22 19:06:39 2015
@@ -31,6 +31,8 @@ public:
};
}
+InputFile::~InputFile() {}
+
template <class ELFT>
ELFFileBase<ELFT>::ELFFileBase(Kind K, MemoryBufferRef M)
: InputFile(K, M), ELFObj(MB.getBuffer(), ECRAII().getEC()) {}
Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=256309&r1=256308&r2=256309&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Tue Dec 22 19:06:39 2015
@@ -35,6 +35,7 @@ class InputFile {
public:
enum Kind { ObjectKind, SharedKind, ArchiveKind };
Kind kind() const { return FileKind; }
+ virtual ~InputFile();
StringRef getName() const { return MB.getBufferIdentifier(); }
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=256309&r1=256308&r2=256309&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Tue Dec 22 19:06:39 2015
@@ -270,6 +270,10 @@ template <class ELFT> class UndefinedElf
public:
UndefinedElf(StringRef N, const Elf_Sym &Sym);
const Elf_Sym &Sym;
+
+ static bool classof(const SymbolBody *S) {
+ return S->kind() == SymbolBody::UndefinedElfKind;
+ }
};
template <class ELFT> class SharedSymbol : public Defined<ELFT> {
More information about the llvm-commits
mailing list