[cfe-commits] r147635 - /cfe/trunk/lib/Lex/Pragma.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Jan 5 16:22:09 PST 2012


Author: akirtzidis
Date: Thu Jan  5 18:22:09 2012
New Revision: 147635

URL: http://llvm.org/viewvc/llvm-project?rev=147635&view=rev
Log:
Fix a memory leak of PragmaNamespaces, rdar://10611796.

Modified:
    cfe/trunk/lib/Lex/Pragma.cpp

Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=147635&r1=147634&r2=147635&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Thu Jan  5 18:22:09 2012
@@ -714,8 +714,10 @@
 
   // If this is a non-default namespace and it is now empty, remove
   // it.
-  if (NS != PragmaHandlers && NS->IsEmpty())
+  if (NS != PragmaHandlers && NS->IsEmpty()) {
     PragmaHandlers->RemovePragmaHandler(NS);
+    delete NS;
+  }
 }
 
 bool Preprocessor::LexOnOffSwitch(tok::OnOffSwitch &Result) {





More information about the cfe-commits mailing list