mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 04:58:21 +00:00
Avoid resource leaks (Coverity-1402818, Coverity-1402812)
This commit is contained in:
parent
4db6d00372
commit
69023a0c75
1 changed files with 2 additions and 2 deletions
|
@ -492,25 +492,25 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
||||||
|
|
||||||
while ( i < numElements )
|
while ( i < numElements )
|
||||||
{
|
{
|
||||||
Bucket* b = new Bucket();
|
|
||||||
auto elements_count = caf::get_if<uint64>(&(*v)[idx++]);
|
auto elements_count = caf::get_if<uint64>(&(*v)[idx++]);
|
||||||
auto count = caf::get_if<uint64>(&(*v)[idx++]);
|
auto count = caf::get_if<uint64>(&(*v)[idx++]);
|
||||||
|
|
||||||
if ( ! (elements_count && count) )
|
if ( ! (elements_count && count) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Bucket* b = new Bucket();
|
||||||
b->count = *count;
|
b->count = *count;
|
||||||
b->bucketPos = buckets.insert(buckets.end(), b);
|
b->bucketPos = buckets.insert(buckets.end(), b);
|
||||||
|
|
||||||
for ( uint64_t j = 0; j < *elements_count; j++ )
|
for ( uint64_t j = 0; j < *elements_count; j++ )
|
||||||
{
|
{
|
||||||
Element* e = new Element();
|
|
||||||
auto epsilon = caf::get_if<uint64>(&(*v)[idx++]);
|
auto epsilon = caf::get_if<uint64>(&(*v)[idx++]);
|
||||||
Val* val = bro_broker::data_to_val((*v)[idx++], type);
|
Val* val = bro_broker::data_to_val((*v)[idx++], type);
|
||||||
|
|
||||||
if ( ! (epsilon && val) )
|
if ( ! (epsilon && val) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Element* e = new Element();
|
||||||
e->epsilon = *epsilon;
|
e->epsilon = *epsilon;
|
||||||
e->value = val;
|
e->value = val;
|
||||||
e->parent = b;
|
e->parent = b;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue