mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Fix bloom filter memory leaks.
This commit is contained in:
parent
13842f2fd5
commit
fb8b78840b
3 changed files with 121 additions and 0 deletions
|
@ -125,6 +125,11 @@ BasicBloomFilter::BasicBloomFilter(const Hasher* hasher, size_t cells)
|
|||
bits = new BitVector(cells);
|
||||
}
|
||||
|
||||
BasicBloomFilter::~BasicBloomFilter()
|
||||
{
|
||||
delete bits;
|
||||
}
|
||||
|
||||
IMPLEMENT_SERIAL(BasicBloomFilter, SER_BASICBLOOMFILTER)
|
||||
|
||||
bool BasicBloomFilter::DoSerialize(SerialInfo* info) const
|
||||
|
@ -173,6 +178,11 @@ CountingBloomFilter::CountingBloomFilter(const Hasher* hasher,
|
|||
cells = new CounterVector(width, arg_cells);
|
||||
}
|
||||
|
||||
CountingBloomFilter::~CountingBloomFilter()
|
||||
{
|
||||
delete cells;
|
||||
}
|
||||
|
||||
bool CountingBloomFilter::Empty() const
|
||||
{
|
||||
return cells->AllZero();
|
||||
|
|
|
@ -124,6 +124,11 @@ public:
|
|||
*/
|
||||
BasicBloomFilter(const Hasher* hasher, size_t cells);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~BasicBloomFilter();
|
||||
|
||||
/**
|
||||
* Computes the number of cells based on a given false positive rate
|
||||
* and capacity. In the literature, this parameter often has the name
|
||||
|
@ -192,6 +197,11 @@ public:
|
|||
*/
|
||||
CountingBloomFilter(const Hasher* hasher, size_t cells, size_t width);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
~CountingBloomFilter();
|
||||
|
||||
// Overridden from BloomFilter.
|
||||
virtual bool Empty() const;
|
||||
virtual void Clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue