mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 20:52:15 +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 {
|
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 New Issue
Block a user