From a1f17f83959123f1f599bf81f08dcdb3c3601114 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 12 Jul 2011 18:22:07 +0000 Subject: [PATCH] Delete StructType bodies when destroying a StructType. Leak found by valgrind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134994 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/DerivedTypes.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 0f1e99f1349..acb28deada1 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -190,6 +190,10 @@ class StructType : public CompositeType { /// void *SymbolTableEntry; public: + ~StructType() { + delete [] ContainedTys; // Delete the body. + } + /// StructType::createNamed - This creates a named struct with no body /// specified. If the name is empty, it creates an unnamed struct, which has /// a unique identity but no actual name. -- 2.34.1