[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
This commit is contained in:
Chandler Carruth 2014-05-02 21:44:48 +00:00
parent 6dd9f8feb3
commit 4d9c3df429
1 changed files with 1 additions and 0 deletions

View File

@ -1403,6 +1403,7 @@ void Preprocessor::IgnorePragmas() {
"Invalid namespace, registered as a regular pragma handler!"); "Invalid namespace, registered as a regular pragma handler!");
if (PragmaHandler *Existing = STDCNamespace->FindHandler("", false)) { if (PragmaHandler *Existing = STDCNamespace->FindHandler("", false)) {
RemovePragmaHandler("STDC", Existing); RemovePragmaHandler("STDC", Existing);
delete Existing;
} }
} }
AddPragmaHandler("STDC", new EmptyPragmaHandler()); AddPragmaHandler("STDC", new EmptyPragmaHandler());