diff --git a/leveldb.go b/leveldb.go index 34b8e51..9a3513e 100644 --- a/leveldb.go +++ b/leveldb.go @@ -41,10 +41,11 @@ func (ldb *LevelDBBackend) Shutdown() error { return nil } -func (ldb *LevelDBBackend) Fetch(hash, key []byte) ([]byte, error) { +func (ldb *LevelDBBackend) Fetch(hash, key []byte) (value []byte, err error) { ro := leveldb.NewReadOptions() - defer ro.Close() - return ldb.db.Get(ro, key) + value, err = ldb.db.Get(ro, key) + ro.Close() + return } func (ldb *LevelDBBackend) InTransaction() bool {