Skip to content

Commit

Permalink
go/store/nbs: ghost_store.go: Close file after initialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
reltuk committed Jan 15, 2025
1 parent 16788c6 commit 0b17081
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go/store/nbs/ghost_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func NewGhostBlockStore(nomsPath string) (*GhostBlockStore, error) {
// Other error, permission denied, etc, we want to hear about.
return nil, err
}
defer f.Close()
scanner := bufio.NewScanner(f)
skiplist := &hash.HashSet{}
for scanner.Scan() {
Expand Down Expand Up @@ -107,6 +108,7 @@ func (g *GhostBlockStore) PersistGhostHashes(ctx context.Context, hashes hash.Ha
if err != nil {
return err
}
defer f.Close()

for h := range hashes {
if _, err := f.WriteString(h.String() + "\n"); err != nil {
Expand Down

0 comments on commit 0b17081

Please sign in to comment.