From 2b8836184971997e24d4c1fa5e9af1b5f0db2740 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Tue, 9 Apr 2024 11:53:18 +0300 Subject: [PATCH] [#1062] object: Fix buffer allocation for `PayloadRange` Signed-off-by: Anton Nikiforov --- pkg/services/object/internal/client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/services/object/internal/client/client.go b/pkg/services/object/internal/client/client.go index dd2de0fd1..4634c96e1 100644 --- a/pkg/services/object/internal/client/client.go +++ b/pkg/services/object/internal/client/client.go @@ -348,7 +348,7 @@ func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, e ln = maxInitialBufferSize } - w := bytes.NewBuffer(make([]byte, ln)) + w := bytes.NewBuffer(make([]byte, 0, ln)) _, err = io.CopyN(w, rdr, int64(prm.ln)) if err != nil { return nil, fmt.Errorf("read payload: %w", err) -- 2.45.2