Close opened files

This commit is contained in:
Jae Kwon 2016-12-06 01:46:23 -08:00
parent 63186e34b3
commit 0416e0aa9c
1 changed files with 4 additions and 0 deletions

View File

@ -444,6 +444,7 @@ func (g *Group) readGroupInfo() GroupInfo {
if err != nil {
panic(err)
}
defer dir.Close()
fiz, err := dir.Readdir(0)
if err != nil {
panic(err)
@ -598,6 +599,9 @@ func (gr *GroupReader) openFile(index int) error {
curReader := bufio.NewReader(curFile)
// Update gr.cur*
if gr.curFile != nil {
gr.curFile.Close() // TODO return error?
}
gr.curIndex = index
gr.curFile = curFile
gr.curReader = curReader