Don't double-free an UnparsedSource
github.com/containers/image.FromUnparsedImage() "takes ownership" of the UnparsedImage that we pass to it, so we shouldn't also Close() the UnparsedImage ourselves after we've wrapped it up in an Image object. Since creating an Image is the only thing we do with the UnparsedImage after creating it from a SourceImage, just use the FromSource() function to handle both steps at once. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
parent
120af8ef01
commit
82c90747c2
1 changed files with 2 additions and 3 deletions
|
@ -137,10 +137,9 @@ func (svc *imageService) CanPull(imageName string, options *copy.Options) (bool,
|
|||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
unparsedImage := image.UnparsedFromSource(rawSource)
|
||||
defer unparsedImage.Close()
|
||||
src, err := image.FromUnparsedImage(unparsedImage)
|
||||
src, err := image.FromSource(rawSource)
|
||||
if err != nil {
|
||||
rawSource.Close()
|
||||
return false, err
|
||||
}
|
||||
src.Close()
|
||||
|
|
Loading…
Reference in a new issue