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 {
|
||||
return errors.New("allocator Put() incorrect buffer size")
|
||||
}
|
||||
if cap(buf) < 1<<6 {
|
||||
return nil
|
||||
}
|
||||
bits -= 6
|
||||
buf = buf[:cap(buf)]
|
||||
|
||||
|
|
Loading…
Reference in a new issue