r208481 - Don't leak default arg tokens on invalid destructors or conversion functions.

Nico Weber nicolasweber at gmx.de
Sat May 10 12:23:28 PDT 2014


Author: nico
Date: Sat May 10 14:23:28 2014
New Revision: 208481

URL: http://llvm.org/viewvc/llvm-project?rev=208481&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/Sema/DeclSpec.h

Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=208481&r1=208480&r2=208481&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Sat May 10 14:23:28 2014
@@ -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;





More information about the cfe-commits mailing list