Skip to content

Commit

Permalink
fix(oci): Add missing writer file closes in directory handler (#628)
Browse files Browse the repository at this point in the history
Reviewed-by: Alexander Jung <[email protected]>
Approved-by: Alexander Jung <[email protected]>
  • Loading branch information
nderjung authored Jul 13, 2023
2 parents ececfc4 + 87726ee commit 54d9504
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions oci/handler/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ func (handle *DirectoryHandler) FetchImage(ctx context.Context, fullref, platfor
if err != nil {
return err
}
defer writer.Close()

if _, err := writer.Write(manifest); err != nil {
return err
Expand Down Expand Up @@ -343,6 +344,7 @@ func (handle *DirectoryHandler) FetchImage(ctx context.Context, fullref, platfor
if err != nil {
return err
}
defer writer.Close()

// Write the config
if _, err = writer.Write(config); err != nil {
Expand Down Expand Up @@ -382,11 +384,13 @@ func (handle *DirectoryHandler) FetchImage(ctx context.Context, fullref, platfor
if err != nil {
return err
}
defer writer.Close()

reader, err := layer.Compressed()
if err != nil {
return err
}
defer reader.Close()

if _, err = io.Copy(writer, reader); err != nil {
return err
Expand Down

0 comments on commit 54d9504

Please sign in to comment.