From 3aad26e4da495178885ed0841996fb1dd4a17de5 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 9 Apr 2007 17:20:18 +0000 Subject: [PATCH] Remove a memory leak, until ParamAttrsList is uniqued. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35823 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Type.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 0e74f2e4f89..ace800dfb2b 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -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)]; -- 2.34.1