From 5c5b5a6253bc0ead6b57805c23298082f2fc5eea Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Sat, 2 Sep 2017 05:14:55 +0000 Subject: [PATCH] Return copy of XML dump COFF/DriverUtils.cpp uses buffer after WindowsManifestMerger destroyed. llvm-svn: 312408 --- llvm/lib/WindowsManifest/WindowsManifestMerger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/WindowsManifest/WindowsManifestMerger.cpp b/llvm/lib/WindowsManifest/WindowsManifestMerger.cpp index c1ace5065e62..2d443a5ca2d7 100644 --- a/llvm/lib/WindowsManifest/WindowsManifestMerger.cpp +++ b/llvm/lib/WindowsManifest/WindowsManifestMerger.cpp @@ -677,7 +677,7 @@ WindowsManifestMerger::WindowsManifestMergerImpl::getMergedManifest() { Buffer.reset(Buff); } - return BufferSize ? MemoryBuffer::getMemBuffer(StringRef( + return BufferSize ? MemoryBuffer::getMemBufferCopy(StringRef( FROM_XML_CHAR(Buffer.get()), (size_t)BufferSize)) : nullptr; }