Skip to content

Commit

Permalink
imagebuildah: don't leak image structs
Browse files Browse the repository at this point in the history
When reading the configuration of a cache candidate, don't leak the
object reference for the Image.

Signed-off-by: Nalin Dahyabhai <[email protected]>

Closes: #1520
Approved by: rhatdan
  • Loading branch information
nalind authored and rh-atomic-bot committed Apr 16, 2019
1 parent 32accb9 commit ffd8d6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions imagebuildah/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1225,11 +1225,12 @@ func (b *Executor) getImageHistory(ctx context.Context, imageID string) ([]v1.Hi
}
ref, err := imageRef.NewImage(ctx, nil)
if err != nil {
return nil, errors.Wrap(err, "error creating new image from reference")
return nil, errors.Wrapf(err, "error creating new image from reference to image %q", imageID)
}
defer ref.Close()
oci, err := ref.OCIConfig(ctx)
if err != nil {
return nil, errors.Wrapf(err, "error getting oci config of image %q", imageID)
return nil, errors.Wrapf(err, "error getting possibly-converted OCI config of image %q", imageID)
}
return oci.History, nil
}
Expand Down

0 comments on commit ffd8d6a

Please sign in to comment.