Close IndexFile if we couldn't create a Searcher out of it.
This fixes repeated OOMs when running index version upgrades. Since
the directory contains many files we can't read, not closing files
leaks mmap'd memory.
Change-Id: I8936b40dcb7d6a9f8a054e4c2ef4eccc0f5b5b9e
diff --git a/shards.go b/shards.go
index 7ca103c..a551746 100644
--- a/shards.go
+++ b/shards.go
@@ -64,6 +64,7 @@
}
s, err := NewSearcher(iFile)
if err != nil {
+ iFile.Close()
return nil, fmt.Errorf("NewSearcher(%s): %v", fn, err)
}