mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Close readclosers returned by DecompressStream
Signed-off-by: Joe Ferguson <joe@infosiftr.com>
This commit is contained in:
parent
1fe0e49d20
commit
76e99e1a8b
3 changed files with 5 additions and 1 deletions
|
@ -127,6 +127,7 @@ func IsArchivePath(path string) bool {
|
|||
if err != nil {
|
||||
return false
|
||||
}
|
||||
defer rdr.Close()
|
||||
r := tar.NewReader(rdr)
|
||||
_, err = r.Next()
|
||||
return err == nil
|
||||
|
|
|
@ -247,10 +247,12 @@ func applyLayerHandler(dest string, layer io.Reader, options *TarOptions, decomp
|
|||
defer system.Umask(oldmask) // ignore err, ErrNotSupportedPlatform
|
||||
|
||||
if decompress {
|
||||
layer, err = DecompressStream(layer)
|
||||
decompLayer, err := DecompressStream(layer)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
defer decompLayer.Close()
|
||||
layer = decompLayer
|
||||
}
|
||||
return UnpackLayer(dest, layer, options)
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ func (dm *downloadManager) Download(ctx context.Context, initialRootFS image.Roo
|
|||
if err != nil {
|
||||
return initialRootFS, nil, err
|
||||
}
|
||||
defer inflatedLayerData.Close()
|
||||
digester := digest.Canonical.Digester()
|
||||
if _, err := chrootarchive.ApplyLayer(dm.tmpDir, io.TeeReader(inflatedLayerData, digester.Hash())); err != nil {
|
||||
return initialRootFS, nil, err
|
||||
|
|
Loading…
Reference in a new issue