From a052d326095e6d7af2a587c5b65c7763c2a4c50e Mon Sep 17 00:00:00 2001 From: beorn7 Date: Tue, 14 Apr 2015 10:49:43 +0200 Subject: [PATCH] Comment improvement. --- storage/local/persistence.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/local/persistence.go b/storage/local/persistence.go index 67de524bc6..2cce4cf73f 100644 --- a/storage/local/persistence.go +++ b/storage/local/persistence.go @@ -387,6 +387,8 @@ func (p *persistence) loadChunks(fp clientmodel.Fingerprint, indexes []int, inde chunks := make([]chunk, 0, len(indexes)) buf := p.bufPool.Get().([]byte) defer func() { + // buf may change below, so wrap returning to the pool in a function. + // A simple 'defer p.bufPool.Put(buf)' would only return the original buf. p.bufPool.Put(buf) }()