Add virtual destructor to WasmYAML::Section or avoid memory leak

Tested locally with -DLLVM_USE_SANITIZER=Address

Differential Revision: https://reviews.llvm.org/D31551

Patch by Sam Clegg

llvm-svn: 299270
This commit is contained in:
Derek Schuff 2017-03-31 22:14:14 +00:00
parent b5a9d6bfb3
commit e5945bcdb2
2 changed files with 10 additions and 0 deletions

View File

@ -108,6 +108,7 @@ struct Signature {
struct Section {
Section(SectionType SecType) : Type(SecType) {}
virtual ~Section();
SectionType Type;
std::vector<Relocation> Relocations;

View File

@ -17,6 +17,15 @@
#include "llvm/Support/MipsABIFlags.h"
namespace llvm {
namespace WasmYAML {
// Declared here rather than in the header to comply with:
// http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers
Section::~Section() {}
} // end namespace WasmYAML
namespace yaml {
void MappingTraits<WasmYAML::FileHeader>::mapping(