mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Fix double close() in FilerSerializer class.
This commit is contained in:
parent
c3aba199f6
commit
c48a16664b
1 changed files with 4 additions and 3 deletions
|
@ -742,9 +742,10 @@ FileSerializer::~FileSerializer()
|
|||
io->Flush();
|
||||
|
||||
delete [] file;
|
||||
delete io;
|
||||
|
||||
if ( fd >= 0 )
|
||||
if ( io )
|
||||
delete io; // destructor will call close() on fd
|
||||
else if ( fd >= 0 )
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
@ -808,7 +809,7 @@ void FileSerializer::CloseFile()
|
|||
if ( io )
|
||||
io->Flush();
|
||||
|
||||
if ( fd >= 0 )
|
||||
if ( fd >= 0 && ! io ) // destructor of io calls close() on fd
|
||||
close(fd);
|
||||
fd = -1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue