Refactor SerializationFormat::EndWrite and ChunkedIO::Chunk mem mgmt.

SerializationFormat::EndWrite now transfers ownership of the buffer
to the caller instead of doing a memcpy.

ChunkedIO::Chunk is no longer a POD type, hopefully the ctor/dtor
make it easier to manage its associated memory.  It also now
tracks how to deallocate its buffer (i.e. delete vs. free).
This commit is contained in:
Jon Siwek 2014-03-18 14:42:38 -05:00
parent 07a4a8d147
commit 70131b5c84
9 changed files with 87 additions and 77 deletions

View file

@ -131,7 +131,7 @@ BroType* BroType::Clone() const
sinfo.cache = false;
this->Serialize(&sinfo);
char* data = 0;
char* data;
uint32 len = form->EndWrite(&data);
form->StartRead(data, len);
@ -141,7 +141,7 @@ BroType* BroType::Clone() const
BroType* rval = this->Unserialize(&uinfo, false);
assert(rval != this);
delete [] data;
free(data);
return rval;
}