Remove a memory leak, until ParamAttrsList is uniqued.
authorReid Spencer <rspencer@reidspencer.com>
Mon, 9 Apr 2007 17:20:18 +0000 (17:20 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 9 Apr 2007 17:20:18 +0000 (17:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35823 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Type.cpp

index 0e74f2e4f89b1d68accafcbaac9efee8b715f5ae..ace800dfb2b6bbec4b51db949a5489ffc7e0e574 100644 (file)
@@ -1098,7 +1098,11 @@ FunctionType *FunctionType::get(const Type *ReturnType,
 
   FunctionValType VT(ReturnType, Params, isVarArg, Attrs);
   FunctionType *MT = FunctionTypes->get(VT);
-  if (MT) return MT;
+  if (MT) { 
+    delete Attrs; // not needed any more
+    return MT;
+  }
+
 
   MT = (FunctionType*) new char[sizeof(FunctionType) + 
                                 sizeof(PATypeHandle)*(Params.size()+1)];