Merge pull request #20823 from nalind/close-that-readcloser

utils: close a couple of ReadClosers
This commit is contained in:
openshift-merge-bot[bot] 2023-11-29 02:18:06 +00:00 committed by GitHub
commit e0a524f630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -77,6 +77,7 @@ func TarToFilesystem(source string, tarball *os.File) error {
if err != nil { if err != nil {
return err return err
} }
defer tb.Close()
_, err = io.Copy(tarball, tb) _, err = io.Copy(tarball, tb)
if err != nil { if err != nil {
return err return err
@ -98,6 +99,7 @@ func TarChrootToFilesystem(source string, tarball *os.File) error {
if err != nil { if err != nil {
return err return err
} }
defer tb.Close()
_, err = io.Copy(tarball, tb) _, err = io.Copy(tarball, tb)
if err != nil { if err != nil {
return err return err