Close more files.

Test: m nothing
Change-Id: I4914337feb4ee2499c270b8504a097a2fd597ab3
This commit is contained in:
Liz Kammer 2022-02-07 13:18:15 -05:00
parent cc1a2062f0
commit 7fe2400039
2 changed files with 2 additions and 0 deletions

View file

@ -847,6 +847,7 @@ func (f *Finder) startFromExternalCache() (err error) {
if err != nil { if err != nil {
return errors.New("No data to load from database\n") return errors.New("No data to load from database\n")
} }
defer reader.Close()
bufferedReader := bufio.NewReader(reader) bufferedReader := bufio.NewReader(reader)
if !f.validateCacheHeader(bufferedReader) { if !f.validateCacheHeader(bufferedReader) {
return errors.New("Cache header does not match") return errors.New("Cache header does not match")

View file

@ -74,6 +74,7 @@ func Read(t *testing.T, path string, filesystem *MockFs) string {
if err != nil { if err != nil {
t.Fatalf(err.Error()) t.Fatalf(err.Error())
} }
defer reader.Close()
bytes, err := ioutil.ReadAll(reader) bytes, err := ioutil.ReadAll(reader)
if err != nil { if err != nil {
t.Fatal(err.Error()) t.Fatal(err.Error())