Skip to content

Commit 0704918

Browse files
authored
Merge pull request #62440 from DougGregor/macros-plug-leak
2 parents 31b1820 + c70dbf0 commit 0704918

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Sema/TypeCheckMacros.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ Expr *swift::expandMacroExpr(
214214

215215
// Create a new source buffer with the contents of the expanded macro.
216216
auto macroBuffer =
217-
llvm::MemoryBuffer::getMemBuffer(evaluatedSource, bufferName);
217+
llvm::MemoryBuffer::getMemBufferCopy(evaluatedSource, bufferName);
218218
unsigned macroBufferID = sourceMgr.addNewSourceBuffer(std::move(macroBuffer));
219+
free((void*)evaluatedSource.data());
219220

220221
// Create a source file to hold the macro buffer. This is automatically
221222
// registered with the enclosing module.

0 commit comments

Comments
 (0)