mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
fix small memory leak (field description given to readers was never freed).
This commit is contained in:
parent
6c4a40f176
commit
f73de0bc8c
3 changed files with 16 additions and 1 deletions
|
@ -169,6 +169,9 @@ bool ReaderBackend::Init(string arg_source, int mode, const int arg_num_fields,
|
|||
source = arg_source;
|
||||
SetName("InputReader/"+source);
|
||||
|
||||
num_fields = arg_num_fields;
|
||||
fields = arg_fields;
|
||||
|
||||
// disable if DoInit returns error.
|
||||
int success = DoInit(arg_source, mode, arg_num_fields, arg_fields);
|
||||
|
||||
|
@ -188,6 +191,16 @@ void ReaderBackend::Finish()
|
|||
disabled = true;
|
||||
DisableFrontend();
|
||||
SendOut(new ReaderFinishedMessage(frontend));
|
||||
|
||||
if ( fields != 0 ) {
|
||||
|
||||
for ( unsigned int i = 0; i < num_fields; i++ ) {
|
||||
delete(fields[i]);
|
||||
}
|
||||
|
||||
delete[] (fields);
|
||||
fields = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool ReaderBackend::Update()
|
||||
|
|
|
@ -228,6 +228,9 @@ private:
|
|||
char* buf;
|
||||
unsigned int buf_len;
|
||||
bool autostart;
|
||||
|
||||
unsigned int num_fields;
|
||||
const threading::Field* const * fields; // raw mapping
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,6 @@ Ascii::Ascii(ReaderFrontend *frontend) : ReaderBackend(frontend)
|
|||
Ascii::~Ascii()
|
||||
{
|
||||
DoFinish();
|
||||
|
||||
}
|
||||
|
||||
void Ascii::DoFinish()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue