Fix parse-time RecordVal tracking containing duplicates

The same RecordVal was unintentionally being added to the list within
a loop over its fields instead of just once per ctor.
This commit is contained in:
Jon Siwek 2019-05-23 10:49:38 -07:00
parent 0f2e778216
commit 8d6dbc2d46
3 changed files with 11 additions and 7 deletions

View file

@ -1,4 +1,8 @@
2.6-326 | 2019-05-23 10:49:38 -0700
* Fix parse-time RecordVal tracking containing duplicates (Jon Siwek, Corelight)
2.6-325 | 2019-05-22 23:56:23 -0700 2.6-325 | 2019-05-22 23:56:23 -0700
* Add leak-checks for new copy operations (Johanna Amann, Corelight) * Add leak-checks for new copy operations (Johanna Amann, Corelight)

View file

@ -1 +1 @@
2.6-325 2.6-326

View file

@ -2887,6 +2887,12 @@ RecordVal::RecordVal(RecordType* t, bool init_fields) : MutableVal(t)
int n = record_type->NumFields(); int n = record_type->NumFields();
val_list* vl = val.val_list_val = new val_list(n); val_list* vl = val.val_list_val = new val_list(n);
if ( is_parsing )
{
parse_time_records.emplace_back(this);
Ref();
}
if ( ! init_fields ) if ( ! init_fields )
return; return;
@ -2928,12 +2934,6 @@ RecordVal::RecordVal(RecordType* t, bool init_fields) : MutableVal(t)
vl->append(def ? def->Ref() : 0); vl->append(def ? def->Ref() : 0);
Unref(def); Unref(def);
if ( is_parsing )
{
parse_time_records.emplace_back(this);
Ref();
}
} }
} }