From 7fe24000393f079be9d44a3d24fbdb9ca47801a7 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Mon, 7 Feb 2022 13:18:15 -0500 Subject: [PATCH] Close more files. Test: m nothing Change-Id: I4914337feb4ee2499c270b8504a097a2fd597ab3 --- finder/finder.go | 1 + finder/fs/test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/finder/finder.go b/finder/finder.go index 5413fa6bb..b4834b16b 100644 --- a/finder/finder.go +++ b/finder/finder.go @@ -847,6 +847,7 @@ func (f *Finder) startFromExternalCache() (err error) { if err != nil { return errors.New("No data to load from database\n") } + defer reader.Close() bufferedReader := bufio.NewReader(reader) if !f.validateCacheHeader(bufferedReader) { return errors.New("Cache header does not match") diff --git a/finder/fs/test.go b/finder/fs/test.go index cb2140e75..ed981fd0e 100644 --- a/finder/fs/test.go +++ b/finder/fs/test.go @@ -74,6 +74,7 @@ func Read(t *testing.T, path string, filesystem *MockFs) string { if err != nil { t.Fatalf(err.Error()) } + defer reader.Close() bytes, err := ioutil.ReadAll(reader) if err != nil { t.Fatal(err.Error())