Merge pull request #3915 from crosbymichael/no-double-put
No no put put
This commit is contained in:
commit
b5d6208ccf
2 changed files with 8 additions and 4 deletions
10
container.go
10
container.go
|
@ -1416,9 +1416,12 @@ func (container *Container) ExportRw() (archive.Archive, error) {
|
|||
if container.runtime == nil {
|
||||
return nil, fmt.Errorf("Can't load storage driver for unregistered container %s", container.ID)
|
||||
}
|
||||
defer container.Unmount()
|
||||
|
||||
return container.runtime.Diff(container)
|
||||
archive, err := container.runtime.Diff(container)
|
||||
if err != nil {
|
||||
container.Unmount()
|
||||
return nil, err
|
||||
}
|
||||
return EofReader(archive, func() { container.Unmount() }), nil
|
||||
}
|
||||
|
||||
func (container *Container) Export() (archive.Archive, error) {
|
||||
|
@ -1428,6 +1431,7 @@ func (container *Container) Export() (archive.Archive, error) {
|
|||
|
||||
archive, err := archive.Tar(container.basefs, archive.Uncompressed)
|
||||
if err != nil {
|
||||
container.Unmount()
|
||||
return nil, err
|
||||
}
|
||||
return EofReader(archive, func() { container.Unmount() }), nil
|
||||
|
|
2
image.go
2
image.go
|
@ -163,7 +163,7 @@ func (img *Image) TarLayer() (arch archive.Archive, err error) {
|
|||
}
|
||||
|
||||
defer func() {
|
||||
if err == nil {
|
||||
if err != nil {
|
||||
driver.Put(img.ID)
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Add table
Reference in a new issue