Skip to content

Commit

Permalink
defer closing file (anchore#1668)
Browse files Browse the repository at this point in the history
Signed-off-by: razzle <harry@razzle.cloud>
  • Loading branch information
Noxsios authored Mar 15, 2023
1 parent 6fd87f1 commit 1d055eb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions syft/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ func (s *Source) SetID() {
case FileScheme:
// attempt to use the digest of the contents of the file as the ID
file, err := os.Open(s.Metadata.Path)
defer file.Close()
if err != nil {
d = digest.FromString(s.Metadata.Path).String()
break
Expand Down

0 comments on commit 1d055eb

Please # to comment.