mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-09-29 19:37:54 +00:00
fix: Pool panic when putting small buffer
This commit is contained in:
parent
7efd692bbc
commit
3b57a923fd
1 changed files with 3 additions and 0 deletions
|
@ -96,6 +96,9 @@ func (alloc *Allocator) Put(buf []byte) error {
|
||||||
if cap(buf) != 1<<bits {
|
if cap(buf) != 1<<bits {
|
||||||
return errors.New("allocator Put() incorrect buffer size")
|
return errors.New("allocator Put() incorrect buffer size")
|
||||||
}
|
}
|
||||||
|
if cap(buf) < 1<<6 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
bits -= 6
|
bits -= 6
|
||||||
buf = buf[:cap(buf)]
|
buf = buf[:cap(buf)]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue