]> granicus.if.org Git - clang/commitdiff
Don't leak default arg tokens on invalid destructors or conversion functions.
authorNico Weber <nicolasweber@gmx.de>
Sat, 10 May 2014 19:23:28 +0000 (19:23 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 10 May 2014 19:23:28 +0000 (19:23 +0000)
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

include/clang/Sema/DeclSpec.h

index 845e7513518e341bb27cb59d121f848a8bdf47c8..493f68708a4b5b9cf955b779c9cccf84d21942b2 100644 (file)
@@ -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;