mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
cmd: fix potential resource leaks
Signed-off-by: luchenhan <hanluchen@aliyun.com>
This commit is contained in:
parent
ad4fb2c729
commit
4e14b1334a
1 changed files with 2 additions and 0 deletions
|
|
@ -182,12 +182,14 @@ func runCmd(ctx *cli.Context) error {
|
|||
//Try reading from stdin
|
||||
if hexcode, err = io.ReadAll(os.Stdin); err != nil {
|
||||
fmt.Printf("Could not load code from stdin: %v\n", err)
|
||||
triedb.Close()
|
||||
os.Exit(1)
|
||||
}
|
||||
} else {
|
||||
// Codefile with hex assembly
|
||||
if hexcode, err = os.ReadFile(codeFileFlag); err != nil {
|
||||
fmt.Printf("Could not load code from file: %v\n", err)
|
||||
triedb.Close()
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue