1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

prevent double release in buffer

This commit is contained in:
v2ray 2016-03-09 11:34:39 +01:00
parent 6f7fff8173
commit be90c04deb

View File

@ -166,10 +166,14 @@ func (p *bufferPool) allocate() *Buffer {
}
func (p *bufferPool) free(buffer *Buffer) {
rawBuffer := buffer.head
if rawBuffer == nil {
return
}
select {
case p.chain <- buffer.head:
case p.chain <- rawBuffer:
default:
p.allocator.Put(buffer.head)
p.allocator.Put(rawBuffer)
}
}