mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
fix: Pool panic when putting small buffer
This commit is contained in:
parent
7efd692bbc
commit
3b57a923fd
|
@ -96,6 +96,9 @@ func (alloc *Allocator) Put(buf []byte) error {
|
|||
if cap(buf) != 1<<bits {
|
||||
return errors.New("allocator Put() incorrect buffer size")
|
||||
}
|
||||
if cap(buf) < 1<<6 {
|
||||
return nil
|
||||
}
|
||||
bits -= 6
|
||||
buf = buf[:cap(buf)]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user