From: Nico Weber Date: Sat, 10 May 2014 19:23:28 +0000 (+0000) Subject: Don't leak default arg tokens on invalid destructors or conversion functions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b29545d6c568ff1c17b76b26990767ef477e03b7;p=clang Don't leak default arg tokens on invalid destructors or conversion functions. Fixes PR19689, and possibly the last leak in clang (PR19521). PR19689 contains a few suggestions on how to make the default argument token code a bit more solid, these changes can possibly be landed in follow-ups. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208481 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 845e751351..493f68708a 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -1231,6 +1231,10 @@ struct DeclaratorChunk { /// /// This is used in various places for error recovery. void freeParams() { + if (Params) { + delete Params->DefaultArgTokens; + Params->DefaultArgTokens = nullptr; + } if (DeleteParams) { delete[] Params; DeleteParams = false;