Skip to content

Commit

Permalink
Merge pull request #596 from chainguard-dev/fix/fd-leak-unpack
Browse files Browse the repository at this point in the history
container: bubblewrap: do not defer closing files
  • Loading branch information
kaniini authored Aug 9, 2023
2 parents 1a45952 + a66c5f7 commit 57f4822
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/container/bubblewrap_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ func (b bubblewrapOCILoader) LoadImage(ctx context.Context, layer v1.Layer, arch
if err != nil {
return ref, fmt.Errorf("failed to create file %s: %w", fullname, err)
}
defer f.Close()
if _, err := io.Copy(f, tr); err != nil {
return ref, fmt.Errorf("failed to copy file %s: %w", fullname, err)
}
f.Close()
case tar.TypeSymlink:
if err := os.Symlink(hdr.Linkname, filepath.Join(guestDir, hdr.Name)); err != nil {
return ref, fmt.Errorf("failed to create symlink %s: %w", fullname, err)
Expand Down

0 comments on commit 57f4822

Please sign in to comment.