From ce52bb3dec520ef94574280ac3ef8ad63f4f1ce2 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 6 Jan 2012 00:22:09 +0000 Subject: [PATCH] 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 --- lib/Lex/Pragma.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) { -- 2.40.0