diff --git a/lld/lib/ReaderWriter/Native/ReaderNative.cpp b/lld/lib/ReaderWriter/Native/ReaderNative.cpp index 36bc7fca6152..13f1a1757c4d 100644 --- a/lld/lib/ReaderWriter/Native/ReaderNative.cpp +++ b/lld/lib/ReaderWriter/Native/ReaderNative.cpp @@ -360,7 +360,7 @@ public: delete _sharedLibraryAtoms._arrayStart; delete _absoluteAtoms._arrayStart; delete _references.arrayStart; - delete _targetsTable; + delete [] _targetsTable; } virtual const atom_collection& defined() const { diff --git a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp index ef22f07813a5..e351cc1104b2 100644 --- a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp +++ b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp @@ -167,7 +167,7 @@ private: // We want _stringCopies to own the string memory so it is deallocated // when the File object is destroyed. But we need a StringRef that // points into that memory. - std::unique_ptr s = std::unique_ptr(new char[str.size()]); + std::unique_ptr s(new char[str.size()]); memcpy(s.get(), str.data(), str.size()); llvm::StringRef r = llvm::StringRef(s.get(), str.size()); _stringCopies.push_back(std::move(s)); @@ -178,7 +178,7 @@ private: unsigned int _unnamedCounter; NameToAtom _nameMap; AtomToRefName _refNames; - std::vector> _stringCopies; + std::vector> _stringCopies; }; @@ -706,7 +706,7 @@ struct MappingTraits { // We want _stringCopies to own the string memory so it is deallocated // when the File object is destroyed. But we need a StringRef that // points into that memory. - std::unique_ptr s = std::unique_ptr(new char[str.size()]); + std::unique_ptr s(new char[str.size()]); memcpy(s.get(), str.data(), str.size()); llvm::StringRef r = llvm::StringRef(s.get(), str.size()); _stringCopies.push_back(std::move(s)); @@ -720,7 +720,7 @@ struct MappingTraits { AtomList _undefinedAtoms; AtomList _sharedLibraryAtoms; AtomList _absoluteAtoms; - std::vector> _stringCopies; + std::vector> _stringCopies; };