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

<rdar://problem/50117620>

llvm-svn: 359003
This commit is contained in:
Adrian Prantl 2019-04-23 15:44:22 +00:00
parent c7bde29cfe
commit 53bd7ce42e
1 changed files with 2 additions and 2 deletions

View File

@ -328,9 +328,9 @@ 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.str();
llvm::sys::path::append(Path, "DWARF", llvm::sys::path::filename(DwarfFile));
return OutputLocation(Path.str(), ResourceDir.str());
return OutputLocation(Path.str(), ResourceDir);
}
/// Parses the command line options into the LinkOptions struct and performs