txn full fix - cursors leak (#1838)

This commit is contained in:
Alex Sharov 2021-04-29 00:00:32 +07:00 committed by GitHub
parent 87fa3d5102
commit 07a063cb8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -657,6 +657,7 @@ func (tx *lmdbTx) Put(bucket string, k, v []byte) error {
if err != nil {
return err
}
defer c.Close()
return c.Put(k, v)
}
@ -670,6 +671,7 @@ func (tx *lmdbTx) Delete(bucket string, k, v []byte) error {
if err != nil {
return err
}
defer c.Close()
return c.Delete(k, v)
}
err := tx.tx.Del(lmdb.DBI(b.DBI), k, v)

View File

@ -712,6 +712,7 @@ func (tx *MdbxTx) Put(bucket string, k, v []byte) error {
if err != nil {
return err
}
defer c.Close()
return c.Put(k, v)
}
@ -725,6 +726,7 @@ func (tx *MdbxTx) Delete(bucket string, k, v []byte) error {
if err != nil {
return err
}
defer c.Close()
return c.Delete(k, v)
}