cmd/geth, cmd/swarm: Fix to close file handler appropriately

This commit is contained in:
Shintaro Kaneko 2017-01-30 01:06:15 +09:00
parent c46c41eae3
commit 355a42f36d
2 changed files with 2 additions and 0 deletions

View File

@ -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 {

View File

@ -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())