diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index c77bd554cdb9897c1d41a2330d624384b2007179..f38ee046f18a9e57e8088132b59bb6446297b79a 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -123,6 +123,7 @@ func initGenesis(ctx *cli.Context) error { if err != nil { utils.Fatalf("failed to read genesis file: %v", err) } + defer genesisFile.Close() block, err := core.WriteGenesisBlock(chaindb, genesisFile) if err != nil { diff --git a/cmd/swarm/hash.go b/cmd/swarm/hash.go index 0a20bea82a86a34ba8ab3dbf1b87b4061b927990..bcba77a2ae69fba1469a59ff36c39f5fabd571b0 100644 --- a/cmd/swarm/hash.go +++ b/cmd/swarm/hash.go @@ -36,6 +36,7 @@ func hash(ctx *cli.Context) { fmt.Println("Error opening file " + args[1]) os.Exit(1) } + defer f.Close() stat, _ := f.Stat() chunker := storage.NewTreeChunker(storage.NewChunkerParams())