From 4d9c3df429c2d26f30c0312cad6a2637ac5f179b Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 2 May 2014 21:44:48 +0000 Subject: [PATCH] [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. llvm-svn: 207872 --- clang/lib/Lex/Pragma.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index 97a08da8ef3e..3e8a40312b44 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -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());