[dsymutil] Fix use-after-free when sys::path::append grows the buffer.

<rdar://problem/50117620>

llvm-svn: 359001
This commit is contained in:
Adrian Prantl 2019-04-23 15:39:13 +00:00
parent 2ce017026a
commit 03e906d9d5
1 changed files with 1 additions and 1 deletions

View File

@ -328,7 +328,7 @@ static Expected<OutputLocation> getOutputFileName(llvm::StringRef InputFile) {
return std::move(E);
llvm::sys::path::append(Path, "Contents", "Resources");
StringRef ResourceDir = Path;
std::string ResourceDir = Path;
llvm::sys::path::append(Path, "DWARF", llvm::sys::path::filename(DwarfFile));
return OutputLocation(Path.str(), ResourceDir.str());
}