aboutsummaryrefslogtreecommitdiff
path: root/libpod/image
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2020-02-07 02:43:14 +0100
committerMiloslav Trmač <mitr@redhat.com>2020-02-07 23:36:01 +0100
commitd9bfaf51977cdc7088fe168d871ac5ce787c9d6a (patch)
tree102691de31425570ff53a03b21248b02713ec3a7 /libpod/image
parent0f0bac4ab31f06403a567d9f28ee4ef69cfe94ca (diff)
downloadpodman-d9bfaf51977cdc7088fe168d871ac5ce787c9d6a.tar.gz
podman-d9bfaf51977cdc7088fe168d871ac5ce787c9d6a.tar.bz2
podman-d9bfaf51977cdc7088fe168d871ac5ce787c9d6a.zip
Create two separate newImage instances in Runtime.New
This is not _trivially_ safe because newImage.getLocalImage() modifies newImage.ImageName, but we overwrite that value anyway. So, this should not change behavior, and it will make future refactoring easier to verify. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'libpod/image')
-rw-r--r--libpod/image/image.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go
index f773ab74a..28148b7c3 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -145,11 +145,11 @@ func (ir *Runtime) New(ctx context.Context, name, signaturePolicyPath, authfile
defer span.Finish()
// We don't know if the image is local or not ... check local first
- newImage := Image{
- InputName: name,
- imageruntime: ir,
- }
if pullType != util.PullImageAlways {
+ newImage := Image{
+ InputName: name,
+ imageruntime: ir,
+ }
localImage, err := newImage.getLocalImage()
if err == nil {
newImage.image = localImage
@@ -168,6 +168,10 @@ func (ir *Runtime) New(ctx context.Context, name, signaturePolicyPath, authfile
return nil, errors.Wrapf(err, "unable to pull %s", name)
}
+ newImage := Image{
+ InputName: name,
+ imageruntime: ir,
+ }
newImage.InputName = imageName[0]
img, err := newImage.getLocalImage()
if err != nil {