aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-16 07:43:38 -0400
committerGitHub <noreply@github.com>2021-04-16 07:43:38 -0400
commit35b62ef19f307fb365eb7a8734e456160f7b22a8 (patch)
tree6f368d27c056fe901623589d3294189dcee9ec07 /libpod
parent4c88035f09474a80264400aa825509900100e32e (diff)
parent12bcfa360d17c6ce40d4fc852b18a901f92c5e75 (diff)
downloadpodman-35b62ef19f307fb365eb7a8734e456160f7b22a8.tar.gz
podman-35b62ef19f307fb365eb7a8734e456160f7b22a8.tar.bz2
podman-35b62ef19f307fb365eb7a8734e456160f7b22a8.zip
Merge pull request #10050 from Luap99/image-prune-panic
Fix possible panic in libpod/image/prune.go
Diffstat (limited to 'libpod')
-rw-r--r--libpod/image/prune.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/libpod/image/prune.go b/libpod/image/prune.go
index 12727901a..0e41fde44 100644
--- a/libpod/image/prune.go
+++ b/libpod/image/prune.go
@@ -134,10 +134,11 @@ func (ir *Runtime) PruneImages(ctx context.Context, all bool, filter []string) (
}
nameOrID := img.ID()
s, err := img.Size(ctx)
- imgSize := *s
+ imgSize := uint64(0)
if err != nil {
logrus.Warnf("Failed to collect image size for: %s, %s", nameOrID, err)
- imgSize = 0
+ } else {
+ imgSize = *s
}
if err := img.Remove(ctx, false); err != nil {
if errors.Cause(err) == storage.ErrImageUsedByContainer {