diff --git a/inspectkv/inspectkv.go b/inspectkv/inspectkv.go index eecaa2f3d8..73e7c3e721 100644 --- a/inspectkv/inspectkv.go +++ b/inspectkv/inspectkv.go @@ -341,6 +341,7 @@ func GetTableRecordsCount(txn kv.Transaction, t table.Table, startHandle int64) for it.Valid() && strings.HasPrefix(it.Key(), prefix) { handle, err := tables.DecodeRecordKeyHandle(it.Key()) if err != nil { + it.Close() return 0, errors.Trace(err) }