Skip to content

Commit

Permalink
[patchstore] fix close files (iotexproject#4268)
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <[email protected]>
Co-authored-by: dustinxie <[email protected]>
  • Loading branch information
testwill and dustinxie authored Jun 3, 2024
1 parent 8b7d540 commit 4fa17a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions action/protocol/staking/patchstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (store *PatchStore) Read(height uint64) (CandidateList, CandidateList, Cand
if err != nil {
return nil, nil, nil, err
}
defer file.Close()
reader := csv.NewReader(file)
reader.FieldsPerRecord = -1
listByName, err := store.read(reader)
Expand Down
1 change: 1 addition & 0 deletions state/factory/patchstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func newPatchStore(fpath string) (*patchStore, error) {
if err != nil {
return nil, errors.Wrapf(err, "failed to open kvstore patch, %s", fpath)
}
defer file.Close()
reader := csv.NewReader(file)
reader.FieldsPerRecord = -1
for {
Expand Down

0 comments on commit 4fa17a3

Please sign in to comment.