Skip to content
Merged
5 changes: 2 additions & 3 deletions pkg/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,12 @@ func (p *BucketedBytes) Put(b *[]byte) {
continue
}
*b = (*b)[:0]
p.mtx.Lock()
defer p.mtx.Unlock()
p.buckets[i].Put(b)
break
}

p.mtx.Lock()
defer p.mtx.Unlock()

// We could assume here that our users will not make the slices larger
// but lets be on the safe side to avoid an underflow of p.usedTotal.
sz := uint64(cap(*b))
Expand Down
Loading