From fd16146ec02fa4fb89dc256fc01f6c4087c0c375 Mon Sep 17 00:00:00 2001 From: Andrew Stone Date: Mon, 18 Sep 2023 03:42:23 -0700 Subject: [PATCH] gzip: Copy bufio.Reader on Reset (#860) The code already checks to see if the buffer can be reused, but since it's not copied in the overwrite, a new buffer is allocated each time. --- gzip/gunzip.go | 1 + 1 file changed, 1 insertion(+) diff --git a/gzip/gunzip.go b/gzip/gunzip.go index 6d630c390d..dc2362a63b 100644 --- a/gzip/gunzip.go +++ b/gzip/gunzip.go @@ -106,6 +106,7 @@ func (z *Reader) Reset(r io.Reader) error { *z = Reader{ decompressor: z.decompressor, multistream: true, + br: z.br, } if rr, ok := r.(flate.Reader); ok { z.r = rr