From db2fdbf38d8e84c9d0a59147022ff01e0084e8b7 Mon Sep 17 00:00:00 2001 From: Bala FA Date: Wed, 1 Jun 2016 00:25:50 +0530 Subject: [PATCH] erasure: allocate buffer only for non-nil disk (#1811) --- erasure-readfile.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erasure-readfile.go b/erasure-readfile.go index 02d9eac0b..84fd2d255 100644 --- a/erasure-readfile.go +++ b/erasure-readfile.go @@ -34,12 +34,11 @@ func (e erasure) ReadFile(volume, path string, startOffset int64, buffer []byte) // Read from all the disks. for index, disk := range e.storageDisks { blockIndex := e.distribution[index] - 1 - // Initialize shard slice and fill the data from each parts. - enBlocks[blockIndex] = make([]byte, curEncBlockSize) if disk == nil { - enBlocks[blockIndex] = nil continue } + // Initialize shard slice and fill the data from each parts. + enBlocks[blockIndex] = make([]byte, curEncBlockSize) // Read the necessary blocks. _, err := disk.ReadFile(volume, path, offsetEncOffset, enBlocks[blockIndex]) if err != nil {