]> granicus.if.org Git - clang/commitdiff
[leaks] Fix a leak recently introduced to the pragma handling. This
authorChandler Carruth <chandlerc@gmail.com>
Fri, 2 May 2014 21:44:48 +0000 (21:44 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 2 May 2014 21:44:48 +0000 (21:44 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207872 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Pragma.cpp

index 97a08da8ef3e88b6037ce749afd482d641415f09..3e8a40312b448e0a6d9900e8ee2d48c2fb254422 100644 (file)
@@ -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());