forked from OSchip/llvm-project
[clang][ASTReader] Fix memory leak while reading FriendTemplateDecls
Allocate on ASTContext, rather than just on heap, so that template parameter lists are freed up. Differential Revision: https://reviews.llvm.org/D120081
This commit is contained in:
parent
535e7b09c1
commit
977b1f574f
|
@ -2103,7 +2103,7 @@ void ASTDeclReader::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue