eth: close last iterator on successful db upgrage

This commit is contained in:
Péter Szilágyi 2017-07-14 15:03:12 +03:00
parent 655a1802fa
commit 7f33092187
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D

View file

@ -53,7 +53,9 @@ func upgradeDeduplicateData(db ethdb.Database) func() error {
// Create an iterator to read the entire database and covert old lookup entires
it := db.(*ethdb.LDBDatabase).NewIterator()
defer func() {
it.Release()
if it != nil {
it.Release()
}
}()
var (
@ -119,6 +121,9 @@ func upgradeDeduplicateData(db ethdb.Database) func() error {
} else {
log.Error("Database deduplication failed", "deduped", converted, "err", failed)
}
it.Release()
it = nil
errc := <-stop
errc <- failed
}()