[cfe-commits] r61007 - /cfe/trunk/lib/AST/DeclarationName.cpp

Nuno Lopes nunoplopes at sapo.pt
Sun Dec 14 09:27:26 PST 2008


Author: nlopes
Date: Sun Dec 14 11:27:25 2008
New Revision: 61007

URL: http://llvm.org/viewvc/llvm-project?rev=61007&view=rev
Log:
fix leakage of CXXSpecialName objects in DeclarationNameTable

Modified:
    cfe/trunk/lib/AST/DeclarationName.cpp

Modified: cfe/trunk/lib/AST/DeclarationName.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclarationName.cpp?rev=61007&r1=61006&r2=61007&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclarationName.cpp (original)
+++ cfe/trunk/lib/AST/DeclarationName.cpp Sun Dec 14 11:27:25 2008
@@ -259,7 +259,16 @@
 }
 
 DeclarationNameTable::~DeclarationNameTable() {
-  delete static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
+  llvm::FoldingSet<CXXSpecialName> *set =
+    static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
+ llvm::FoldingSetIterator<CXXSpecialName> it = set->begin();
+
+  while (it != set->end()) {
+    CXXSpecialName *n = &*it++;
+    delete n;
+  }
+
+  delete set;
   delete [] CXXOperatorNames;
 }
 





More information about the cfe-commits mailing list