From af867a393797d56d6aa922f02540d384880bc92c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 20 Mar 2007 00:18:10 +0000 Subject: Fix a nasty memory leak, caused by my revamp of the value symbol table. llvm-svn: 35195 --- llvm/lib/VMCore/Value.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index 8bc99a8590b..790ae17a983 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/lib/VMCore/Value.cpp @@ -56,6 +56,11 @@ Value::~Value() { #endif assert(use_begin() == use_end() && "Uses remain when a value is destroyed!"); + // If this value is named, destroy the name. This should not be in a symtab + // at this point. + if (Name) + Name->Destroy(); + // There should be no uses of this object anymore, remove it. LeakDetector::removeGarbageObject(this); } -- cgit v1.2.3