Skip to content

Commit 355a42f

Browse files
committed
cmd/geth, cmd/swarm: Fix to close file handler appropriately
1 parent c46c41e commit 355a42f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

cmd/geth/chaincmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ func initGenesis(ctx *cli.Context) error {
123123
if err != nil {
124124
utils.Fatalf("failed to read genesis file: %v", err)
125125
}
126+
defer genesisFile.Close()
126127

127128
block, err := core.WriteGenesisBlock(chaindb, genesisFile)
128129
if err != nil {

cmd/swarm/hash.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func hash(ctx *cli.Context) {
3636
fmt.Println("Error opening file " + args[1])
3737
os.Exit(1)
3838
}
39+
defer f.Close()
3940

4041
stat, _ := f.Stat()
4142
chunker := storage.NewTreeChunker(storage.NewChunkerParams())

0 commit comments

Comments
 (0)