Skip to content

Commit f07c7d1

Browse files
committed
[Type checker] Eliminate a use-after-free due to C++ temporaries.
Found by Brent using ASan, thank you!
1 parent 6fe5245 commit f07c7d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,8 @@ void swift::printFunctionBuilderBuildFunction(
19791979
componentTypeString = "<#Component#>";
19801980

19811981
// Render the code.
1982-
ExtraIndentStreamPrinter printer(out, stubIndent.getValueOr(std::string()));
1982+
std::string stubIndentStr = stubIndent.getValueOr(std::string());
1983+
ExtraIndentStreamPrinter printer(out, stubIndentStr);
19831984

19841985
// If we're supposed to provide a full stub, add a newline and the introducer
19851986
// keywords.

0 commit comments

Comments
 (0)