Skip to content

Commit afbbd54

Browse files
[ADT] Fix a memory leak in SmallDenseMap (#168011)
Tmp.moveFrom(*this); about 10 lines above leaves *this in a zombie state with a bucket array still allocated. This patch fixes the memory leak by calling deallocateBuckets().
1 parent 6b44cea commit afbbd54

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/include/llvm/ADT/DenseMap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,7 @@ class SmallDenseMap
11221122
Tmp.Small = false;
11231123
Tmp.getLargeRep()->NumBuckets = 0;
11241124
} else {
1125+
deallocateBuckets();
11251126
Small = false;
11261127
NumTombstones = 0;
11271128
*getLargeRep() = std::move(*Tmp.getLargeRep());

0 commit comments

Comments
 (0)