summaryrefslogtreecommitdiff
path: root/lib/VMCore/Type.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-04-09 17:20:18 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-04-09 17:20:18 +0000
commit3aad26e4da495178885ed0841996fb1dd4a17de5 (patch)
tree413d68455601fc7c2528a81ea4ed9cef5d25b112 /lib/VMCore/Type.cpp
parent4522c8a44c31503e928ee13dcebc3702b0b4e152 (diff)
downloadllvm-3aad26e4da495178885ed0841996fb1dd4a17de5.tar.gz
llvm-3aad26e4da495178885ed0841996fb1dd4a17de5.tar.bz2
llvm-3aad26e4da495178885ed0841996fb1dd4a17de5.tar.xz
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
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r--lib/VMCore/Type.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 0e74f2e4f8..ace800dfb2 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)];