Skip to content

Evidence store may leak resource #2515

@goolAdapter

Description

@goolAdapter

there is a leak, iter need defer iter.Close().

iter := dbm.IteratePrefix(store.db, []byte(prefixKey))
for ; iter.Valid(); iter.Next() {

by the way,

l2 := make([]types.Evidence, len(l))
for i := range l {
l2[i] = l[len(l)-1-i]
}

should replace with reversing trick to eliminate temp slice.

for i := len(a)/2-1; i >= 0; i-- {
	opp := len(a)-1-i
	a[i], a[opp] = a[opp], a[i]
}

I'll make a PR for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions