r207872 - [leaks] Fix a leak recently introduced to the pragma handling. This

Chandler Carruth chandlerc at gmail.com
Fri May 2 14:44:49 PDT 2014


Author: chandlerc
Date: Fri May  2 16:44:48 2014
New Revision: 207872

URL: http://llvm.org/viewvc/llvm-project?rev=207872&view=rev
Log:
[leaks] Fix a leak recently introduced to the pragma handling. This
whole code would be better with std::unique_ptr managing the lifetimes
of the handlers, but I wanted to make a targeted fix to the leaks first.
With this change, all of the Clang preprocessor tests are leak free with
LSan.

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=207872&r1=207871&r2=207872&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Fri May  2 16:44:48 2014
@@ -1403,6 +1403,7 @@ void Preprocessor::IgnorePragmas() {
            "Invalid namespace, registered as a regular pragma handler!");
     if (PragmaHandler *Existing = STDCNamespace->FindHandler("", false)) {
       RemovePragmaHandler("STDC", Existing);
+      delete Existing;
     }
   }
   AddPragmaHandler("STDC", new EmptyPragmaHandler());





More information about the cfe-commits mailing list