Skip to content

Commit

Permalink
utils: close a couple of ReadClosers
Browse files Browse the repository at this point in the history
utils.Tar() and utils.TarWithChroot() both return ReadClosers, but when
we called them from utils.TarToFilesystem() and utils.TarChrootToFilesystem()
respectively, they were not being closed.

[NO NEW TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <[email protected]>
  • Loading branch information
nalind committed Nov 28, 2023
1 parent 443e779 commit cf1ad30
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func TarToFilesystem(source string, tarball *os.File) error {
if err != nil {
return err
}
defer tb.Close()
_, err = io.Copy(tarball, tb)
if err != nil {
return err
Expand All @@ -98,6 +99,7 @@ func TarChrootToFilesystem(source string, tarball *os.File) error {
if err != nil {
return err
}
defer tb.Close()
_, err = io.Copy(tarball, tb)
if err != nil {
return err
Expand Down

0 comments on commit cf1ad30

Please sign in to comment.