diff options
author | Owen Anderson <resistor@mac.com> | 2007-07-19 06:45:33 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-07-19 06:45:33 +0000 |
commit | ee99010782955668afc5585e4da74b824a5a48db (patch) | |
tree | 7328236305a82db85ecaedf4396e3e10d94d4252 /llvm/lib/Support/SmallPtrSet.cpp | |
parent | 6aa17f1def4f597b55f5c72d2926997547fe9311 (diff) | |
download | bcm5719-llvm-ee99010782955668afc5585e4da74b824a5a48db.tar.gz bcm5719-llvm-ee99010782955668afc5585e4da74b824a5a48db.zip |
Remember to free the heap allocated array if we're not going to use it.
llvm-svn: 40043
Diffstat (limited to 'llvm/lib/Support/SmallPtrSet.cpp')
-rw-r--r-- | llvm/lib/Support/SmallPtrSet.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/SmallPtrSet.cpp b/llvm/lib/Support/SmallPtrSet.cpp index b2c5c42e279..122a71da929 100644 --- a/llvm/lib/Support/SmallPtrSet.cpp +++ b/llvm/lib/Support/SmallPtrSet.cpp @@ -186,10 +186,12 @@ void SmallPtrSetImpl::CopyFrom(const SmallPtrSetImpl &RHS) { "Cannot assign sets with different small sizes"); // If we're becoming small, prepare to insert into our stack space - if (RHS.isSmall()) + if (RHS.isSmall()) { + if (!isSmall()) + free(CurArray); CurArray = &SmallArray[0]; // Otherwise, allocate new heap space (unless we were the same size) - else if (CurArraySize != RHS.CurArraySize) { + } else if (CurArraySize != RHS.CurArraySize) { if (isSmall()) CurArray = (void**)malloc(sizeof(void*) * (RHS.CurArraySize+1)); else |