[llvm-commits] [llvm] r134994 - /llvm/trunk/include/llvm/DerivedTypes.h

Benjamin Kramer benny.kra at googlemail.com
Tue Jul 12 11:22:07 PDT 2011


Author: d0k
Date: Tue Jul 12 13:22:07 2011
New Revision: 134994

URL: http://llvm.org/viewvc/llvm-project?rev=134994&view=rev
Log:
Delete StructType bodies when destroying a StructType.

Leak found by valgrind.

Modified:
    llvm/trunk/include/llvm/DerivedTypes.h

Modified: llvm/trunk/include/llvm/DerivedTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=134994&r1=134993&r2=134994&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DerivedTypes.h (original)
+++ llvm/trunk/include/llvm/DerivedTypes.h Tue Jul 12 13:22:07 2011
@@ -190,6 +190,10 @@
   /// 
   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.





More information about the llvm-commits mailing list