mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
GH-1768: Properly cleanup existing log stream when recreated on with the same ID
This commit is contained in:
parent
e7412e257f
commit
d50dade24c
2 changed files with 11 additions and 2 deletions
|
@ -311,8 +311,11 @@ bool Manager::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
streams.push_back(nullptr);
|
||||
|
||||
if ( streams[idx] )
|
||||
// We already know this one, delete the previous definition.
|
||||
delete streams[idx];
|
||||
{
|
||||
// We already know this one. Clean up the old version before making
|
||||
// a new one.
|
||||
RemoveStream(idx);
|
||||
}
|
||||
|
||||
// Create new stream.
|
||||
streams[idx] = new Stream;
|
||||
|
@ -334,7 +337,11 @@ bool Manager::CreateStream(EnumVal* id, RecordVal* sval)
|
|||
bool Manager::RemoveStream(EnumVal* id)
|
||||
{
|
||||
unsigned int idx = id->AsEnum();
|
||||
return RemoveStream(idx);
|
||||
}
|
||||
|
||||
bool Manager::RemoveStream(unsigned int idx)
|
||||
{
|
||||
if ( idx >= streams.size() || ! streams[idx] )
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue