prevent double release in buffer

pull/109/head
v2ray 2016-03-09 11:34:39 +01:00
parent 6f7fff8173
commit be90c04deb
1 changed files with 6 additions and 2 deletions

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)
}
}