Skip to content

Commit

Permalink
fix: close file when failed to open gzip (#7164)
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <[email protected]>
  • Loading branch information
testwill authored Jul 15, 2024
1 parent 4308a0a commit 2a577a7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/fanal/image/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func fileOpener(fileName string) func() (io.ReadCloser, error) {
if utils.IsGzip(br) {
r, err = gzip.NewReader(br)
if err != nil {
_ = f.Close()
return nil, xerrors.Errorf("failed to open gzip: %w", err)
}
}
Expand Down

0 comments on commit 2a577a7

Please sign in to comment.