Fix ineffective recycling (#18952)

Recycle would always be called on the dummy value `any(newRT())` instead of the actual value given to the recycle function.

Caught by race tests, but mostly harmless, except for reduced perf.

Other minor cleanups. Introduced in #18940 (unreleased)
This commit is contained in:
Klaus Post
2024-02-02 08:48:12 -08:00
committed by GitHub
parent d99d16e8c3
commit ce0cb913bc
2 changed files with 10 additions and 8 deletions
-1
View File
@@ -235,7 +235,6 @@ func (b *Bytes) UnmarshalMsg(bytes []byte) ([]byte, error) {
copy(*b, val)
} else {
if cap(*b) == 0 && len(val) <= maxBufferSize {
PutByteBuffer(*b)
*b = GetByteBuffer()[:0]
} else {
PutByteBuffer(*b)