archive: fix allocation leak

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2017-07-12 10:24:52 -07:00
parent 8ab4a61684
commit 19aed1a049

View File

@ -446,6 +446,7 @@ func createTarFile(ctx context.Context, path, extractDir string, hdr *tar.Header
} }
buf := bufferPool.Get().([]byte) buf := bufferPool.Get().([]byte)
_, err = io.CopyBuffer(file, reader, buf) _, err = io.CopyBuffer(file, reader, buf)
bufferPool.Put(buf)
if err1 := file.Close(); err == nil { if err1 := file.Close(); err == nil {
err = err1 err = err1
} }