From 966daed0941a0bd28c55258664c52fc65ceeb627 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Tue, 25 Mar 2014 13:30:19 -0700 Subject: [PATCH] consul: Fixing issue with cursors not closing in MDB --- consul/mdb_table.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/consul/mdb_table.go b/consul/mdb_table.go index 601f62f194..c1fe6dee87 100644 --- a/consul/mdb_table.go +++ b/consul/mdb_table.go @@ -157,6 +157,7 @@ func (t *MDBTable) restoreLastRowID() error { if err != nil { return err } + defer cursor.Close() key, _, err := cursor.Get(nil, mdb.LAST) if err == mdb.NotFound { @@ -534,6 +535,7 @@ func (i *MDBIndex) iterate(tx *MDBTxn, prefix []byte, if err != nil { return err } + defer cursor.Close() var key, encRowId, objBytes []byte first := true