Don't free StreamWriter buffer until after callbacks

* Some callbacks may want to process the data so we can't free it out from under
  them.
This commit is contained in:
baldurk
2023-06-09 15:04:22 +01:00
parent 96e39bb360
commit 98f2ad00e6
+2 -2
View File
@@ -771,8 +771,6 @@ StreamWriter::StreamWriter(Compressor *compressor, Ownership own)
StreamWriter::~StreamWriter()
{
FreeAlignedBuffer(m_BufferBase);
if(m_Ownership == Ownership::Stream)
{
if(m_File)
@@ -789,6 +787,8 @@ StreamWriter::~StreamWriter()
for(StreamCloseCallback cb : m_Callbacks)
cb();
FreeAlignedBuffer(m_BufferBase);
}
bool StreamWriter::SendSocketData(const void *data, uint64_t numBytes)