[PATCH] D120081: [clang][ASTReader] Fix memory leak while reading FriendTemplateDecls
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 18 03:16:53 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG977b1f574fa1: [clang][ASTReader] Fix memory leak while reading FriendTemplateDecls (authored by kadircet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120081/new/
https://reviews.llvm.org/D120081
Files:
clang/lib/Serialization/ASTReaderDecl.cpp
Index: clang/lib/Serialization/ASTReaderDecl.cpp
===================================================================
--- clang/lib/Serialization/ASTReaderDecl.cpp
+++ clang/lib/Serialization/ASTReaderDecl.cpp
@@ -2103,7 +2103,7 @@
VisitDecl(D);
unsigned NumParams = Record.readInt();
D->NumParams = NumParams;
- D->Params = new TemplateParameterList*[NumParams];
+ D->Params = new (Reader.getContext()) TemplateParameterList *[NumParams];
for (unsigned i = 0; i != NumParams; ++i)
D->Params[i] = Record.readTemplateParameterList();
if (Record.readInt()) // HasFriendDecl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120081.409888.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220218/fc078bc8/attachment.bin>
More information about the cfe-commits
mailing list