From 42e95067dcaf2833a760f77bf7c158aeb3f5e86b Mon Sep 17 00:00:00 2001 From: Andy Bursavich Date: Fri, 13 Sep 2019 08:57:56 -0700 Subject: [PATCH] store: fix chunk pool memory leak (#1512) Signed-off-by: Andy Bursavich --- pkg/store/bucket.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 100b063c41..1834086aab 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -1275,11 +1275,13 @@ func (b *bucketBlock) readChunkRange(ctx context.Context, seq int, off, length i r, err := b.bucket.GetRange(ctx, b.chunkObjs[seq], off, length) if err != nil { + b.chunkPool.Put(c) return nil, errors.Wrap(err, "get range reader") } defer runutil.CloseWithLogOnErr(b.logger, r, "readChunkRange close range reader") if _, err = io.Copy(buf, r); err != nil { + b.chunkPool.Put(c) return nil, errors.Wrap(err, "read range") } internalBuf := buf.Bytes()