fix: handle file close logic (#679)

* handle file close logic

* Update rpc/ethereum/namespaces/debug/utils.go

* update changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
JayT106
2021-10-19 08:55:55 +00:00
committed by GitHub
co-authored by Federico Kunze Küllmer
parent 1076307e6b
commit c644dd6707
2 changed files with 10 additions and 2 deletions
+6 -2
View File
@@ -48,7 +48,11 @@ func writeProfile(name, file string, log log.Logger) error {
if err != nil {
return err
}
defer f.Close()
return p.WriteTo(f, 0)
if err := p.WriteTo(f, 0); err != nil {
f.Close()
return err
}
return f.Close()
}