From 846c9f797e54fed08370501184642f02187d719d Mon Sep 17 00:00:00 2001 From: razzle Date: Tue, 14 Mar 2023 06:34:40 -0500 Subject: [PATCH] defer closing file Signed-off-by: razzle --- syft/source/source.go | 1 + 1 file changed, 1 insertion(+) diff --git a/syft/source/source.go b/syft/source/source.go index 76b5470638e..b0cb948e0ff 100644 --- a/syft/source/source.go +++ b/syft/source/source.go @@ -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