mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 10:08:15 -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) {
|
func (p *bufferPool) free(buffer *Buffer) {
|
||||||
|
rawBuffer := buffer.head
|
||||||
|
if rawBuffer == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
select {
|
select {
|
||||||
case p.chain <- buffer.head:
|
case p.chain <- rawBuffer:
|
||||||
default:
|
default:
|
||||||
p.allocator.Put(buffer.head)
|
p.allocator.Put(rawBuffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user