Delete StructType bodies when destroying a StructType.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 12 Jul 2011 18:22:07 +0000 (18:22 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 12 Jul 2011 18:22:07 +0000 (18:22 +0000)
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

index 0f1e99f13499b9b64b9f905f1ee146eb9d1bdd24..acb28deada10aa9fa2365037b95d50ac2d315c1a 100644 (file)
@@ -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.