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:
parent
6f7fff8173
commit
be90c04deb
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user