Skip to content

Commit

Permalink
[FAB-11961] properly release resource
Browse files Browse the repository at this point in the history
This CR fixes a minor bug - an iterator need to be properly released.

Change-Id: Ic05429f4978067250fa30e1d5c304e744160d37e
Signed-off-by: ping40 <norberthu30@gmail.com>
  • Loading branch information
ping40 committed Sep 13, 2018
1 parent fdc4889 commit 70307a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/transientstore/store.go
Expand Up @@ -345,13 +345,13 @@ func (s *store) GetMinTransientBlkHt() (uint64, error) {
// is to explicitly store the minBlockHeight in the transientStore.
startKey := createPurgeIndexByHeightRangeStartKey(0)
iter := s.db.GetIterator(startKey, nil)
defer iter.Release()
// Fetch the minimum transient block height
if iter.Next() {
dbKey := iter.Key()
_, _, blockHeight := splitCompositeKeyOfPurgeIndexByHeight(dbKey)
return blockHeight, nil
}
iter.Release()
// Returning an error may not be the right thing to do here. May be
// return a bool. -1 is not possible due to unsigned int as first
// return value
Expand Down

0 comments on commit 70307a0

Please sign in to comment.