Skip to content

Commit a07caa8

Browse files
authored
Merge pull request #74941 from rintaro/macros-leak-rdar131048379
[Macros] Fix memory leak
2 parents 2b17ed2 + 432d5bb commit a07caa8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Sema/TypeCheckMacros.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,10 @@ initializePlugin(ASTContext &ctx, CompilerPlugin *plugin, StringRef libraryPath,
259259
});
260260
plugin->addOnReconnect(callback);
261261

262-
plugin->setCleanup([plugin] { swift_ASTGen_deinitializePlugin(plugin); });
262+
plugin->setCleanup([plugin, callback] {
263+
swift_ASTGen_deinitializePlugin(plugin);
264+
delete callback;
265+
});
263266
#endif
264267
}
265268

0 commit comments

Comments
 (0)