1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-03 07:56:42 -05:00

release buffer if payload becomes small

This commit is contained in:
Darien Raymond 2018-03-16 22:32:03 +07:00
parent feb421d9e1
commit b2d9364cb5
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -47,6 +47,9 @@ func (r *BytesToBufferReader) ReadMultiBuffer() (MultiBuffer, error) {
if nBytes == len(r.buffer) && nBytes < xlSize {
freeBytes(r.buffer)
r.buffer = newBytes(uint32(nBytes) + 1)
} else if nBytes < Size {
freeBytes(r.buffer)
r.buffer = nil
}
return mb, nil
}