5748: Put() always takes a non-nil buf.
authorTom Clegg <tom@curoverse.com>
Fri, 15 May 2015 01:52:12 +0000 (21:52 -0400)
committerTom Clegg <tom@curoverse.com>
Fri, 15 May 2015 01:52:12 +0000 (21:52 -0400)
services/keepstore/bufferpool.go
services/keepstore/handlers.go

index 0b216d76bff893fa30379a4003963431a9d309e9..373bfc75a1ca251b0bf851bfe45dfe78fc635ae7 100644 (file)
@@ -39,8 +39,6 @@ func (p *bufferPool) Get(size int) []byte {
 }
 
 func (p *bufferPool) Put(buf []byte) {
-       if buf != nil {
-               p.Pool.Put(buf)
-               <-p.limiter
-       }
+       p.Pool.Put(buf)
+       <-p.limiter
 }
index 7c9ae6427d6cd992131c468276ad9b0ea3dfc313..16c39c2c88f247da8ef011ce2a4ca37f07a9c0c5 100644 (file)
@@ -514,7 +514,6 @@ func GetBlock(hash string, update_timestamp bool) ([]byte, error) {
                        if !os.IsNotExist(err) {
                                log.Printf("GetBlock: reading %s: %s\n", hash, err)
                        }
-                       bufs.Put(buf)
                        continue
                }
                // Check the file checksum.