diff --git a/lld/MachO/ExportTrie.h b/lld/MachO/ExportTrie.h --- a/lld/MachO/ExportTrie.h +++ b/lld/MachO/ExportTrie.h @@ -22,6 +22,7 @@ class TrieBuilder { public: + explicit ~TrieBuilder(); void setImageBase(uint64_t addr) { imageBase = addr; } void addSymbol(const Symbol &sym) { exported.push_back(&sym); } // Returns the size in bytes of the serialized trie. diff --git a/lld/MachO/ExportTrie.cpp b/lld/MachO/ExportTrie.cpp --- a/lld/MachO/ExportTrie.cpp +++ b/lld/MachO/ExportTrie.cpp @@ -145,8 +145,13 @@ } } +TrieNode::~TrieNode() { + for (TrieNode *node : nodes) + delete node; +} + TrieNode *TrieBuilder::makeNode() { - auto *node = make(); + auto *node = new TrieNode(); nodes.emplace_back(node); return node; }