Simplify threading::Value destructor

This commit is contained in:
Jon Siwek 2019-06-04 19:28:06 -07:00
parent 59596e0bfa
commit 80fe3d5583
3 changed files with 14 additions and 6 deletions

View file

@ -1,4 +1,10 @@
2.6-375 | 2019-06-04 19:28:06 -0700
* Simplify threading::Value destructor (Jon Siwek, Corelight)
* Add pattern support to input framework. (Zeke Medley, Corelight)
2.6-369 | 2019-06-04 17:53:10 -0700
* GH-155: Improve coercion of expression lists to vector types (Tim Wojtulewicz, Corelight)

View file

@ -1 +1 @@
2.6-369
2.6-375

View file

@ -87,14 +87,16 @@ string Field::TypeName() const
Value::~Value()
{
if ( (type == TYPE_ENUM || type == TYPE_STRING || type == TYPE_FILE || type == TYPE_FUNC)
&& present )
if ( ! present )
return;
if ( type == TYPE_ENUM || type == TYPE_STRING || type == TYPE_FILE || type == TYPE_FUNC )
delete [] val.string_val.data;
if ( type == TYPE_PATTERN && present)
else if ( type == TYPE_PATTERN )
delete [] val.pattern_text_val;
if ( type == TYPE_TABLE && present )
else if ( type == TYPE_TABLE )
{
for ( int i = 0; i < val.set_val.size; i++ )
delete val.set_val.vals[i];
@ -102,7 +104,7 @@ Value::~Value()
delete [] val.set_val.vals;
}
if ( type == TYPE_VECTOR && present )
else if ( type == TYPE_VECTOR )
{
for ( int i = 0; i < val.vector_val.size; i++ )
delete val.vector_val.vals[i];