Skip to content

Commit

Permalink
fix: close file when failed to open gzip (aquasecurity#7164)
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <[email protected]>
  • Loading branch information
testwill authored and skahn007gl committed Jul 23, 2024
1 parent 536739b commit 9acd526
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 9acd526

Please sign in to comment.