Merge pull request #2184 from huydx/master

Fix possible memory leak by defer inside loop
This commit is contained in:
Björn Rabenstein 2016-11-14 15:26:39 +01:00 committed by GitHub
commit 036715370f
1 changed files with 2 additions and 1 deletions

View File

@ -62,9 +62,9 @@ func (p *persistence) recoverFromCrash(fingerprintToSeries map[model.Fingerprint
if err != nil {
return err
}
defer dir.Close()
for fis := []os.FileInfo{}; err != io.EOF; fis, err = dir.Readdir(1024) {
if err != nil {
dir.Close()
return err
}
for _, fi := range fis {
@ -78,6 +78,7 @@ func (p *persistence) recoverFromCrash(fingerprintToSeries map[model.Fingerprint
}
}
}
dir.Close()
}
log.Infof("File scan complete. %d series found.", len(fpsSeen))