fix: io buffer not shrinked before putting back to pool

This commit is contained in:
yusing 2025-04-16 12:10:11 +08:00
parent 3b4deccd8e
commit 18ab6c52ec

View file

@ -145,7 +145,7 @@ func CopyClose(dst *ContextWriter, src *ContextReader) (err error) {
buf = make([]byte, 0, size)
} else {
buf = copyBufPool.Get().([]byte)
defer copyBufPool.Put(buf)
defer copyBufPool.Put(buf[:0])
}
// close both as soon as one of them is done
wCloser, wCanClose := dst.Writer.(io.Closer)