Fix memory leaks in various input framework error-handling cases

This commit is contained in:
Jon Siwek 2019-12-31 11:08:45 -08:00
parent 3b6a2a5f4e
commit 6f5f7df970

View file

@ -444,6 +444,7 @@ bool Manager::CreateEventStream(RecordVal* fval)
if ( status )
{
reporter->Error("Input stream %s: Problem unrolling", stream_name.c_str());
for ( auto& f : fieldsV ) delete f;
return false;
}
@ -453,6 +454,7 @@ bool Manager::CreateEventStream(RecordVal* fval)
if ( ! res )
{
delete stream;
for ( auto& f : fieldsV ) delete f;
return false;
}
@ -671,6 +673,7 @@ bool Manager::CreateTableStream(RecordVal* fval)
if ( (valfields > 1) && (want_record->InternalInt() != 1) )
{
reporter->Error("Input stream %s: Stream does not want a record (want_record=F), but has more then one value field.", stream_name.c_str());
for ( auto& f : fieldsV ) delete f;
return false;
}
@ -680,6 +683,7 @@ bool Manager::CreateTableStream(RecordVal* fval)
if ( status )
{
reporter->Error("Input stream %s: Problem unrolling", stream_name.c_str());
for ( auto& f : fieldsV ) delete f;
return false;
}
@ -689,6 +693,7 @@ bool Manager::CreateTableStream(RecordVal* fval)
if ( ! res )
{
delete stream;
for ( auto& f : fieldsV ) delete f;
return false;
}
}