Avoid resource leaks (Coverity-1402818, Coverity-1402812)

This commit is contained in:
Tim Wojtulewicz 2019-07-08 15:19:32 -07:00
parent 4db6d00372
commit 69023a0c75

View file

@ -492,25 +492,25 @@ bool TopkVal::DoUnserialize(const broker::data& data)
while ( i < numElements )
{
Bucket* b = new Bucket();
auto elements_count = caf::get_if<uint64>(&(*v)[idx++]);
auto count = caf::get_if<uint64>(&(*v)[idx++]);
if ( ! (elements_count && count) )
return false;
Bucket* b = new Bucket();
b->count = *count;
b->bucketPos = buckets.insert(buckets.end(), b);
for ( uint64_t j = 0; j < *elements_count; j++ )
{
Element* e = new Element();
auto epsilon = caf::get_if<uint64>(&(*v)[idx++]);
Val* val = bro_broker::data_to_val((*v)[idx++], type);
if ( ! (epsilon && val) )
return false;
Element* e = new Element();
e->epsilon = *epsilon;
e->value = val;
e->parent = b;