From: Argyrios Kyrtzidis Date: Fri, 6 Jan 2012 00:22:09 +0000 (+0000) Subject: Fix a memory leak of PragmaNamespaces, rdar://10611796. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce52bb3dec520ef94574280ac3ef8ad63f4f1ce2;p=clang Fix a memory leak of PragmaNamespaces, rdar://10611796. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147635 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index cc612fff9f..1ccfe8c2c9 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -714,8 +714,10 @@ void Preprocessor::RemovePragmaHandler(StringRef Namespace, // 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) {