Don't leak containers/image Image references
In-memory image objects created using an ImageReference's NewImage() method need to be Close()d. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
2e50006f1c
commit
3747048aa4
1 changed files with 2 additions and 0 deletions
|
@ -96,6 +96,7 @@ func matchesLabel(image storage.Image, store storage.Store, label string) bool {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
defer img.Close()
|
||||||
info, err := img.Inspect()
|
info, err := img.Inspect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
|
@ -229,6 +230,7 @@ func Size(store storage.Store, img storage.Image) (int64, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
|
defer imgRef.Close()
|
||||||
imgSize, err := imgRef.Size()
|
imgSize, err := imgRef.Size()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, err
|
return -1, err
|
||||||
|
|
Loading…
Reference in a new issue