mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-14 20:16:36 +00:00
internal/download: close dst on io.Copy error (#34910)
This commit is contained in:
parent
7facf9c129
commit
f63c265092
1 changed files with 1 additions and 0 deletions
|
|
@ -212,6 +212,7 @@ func (db *ChecksumDB) DownloadFile(url, dstPath string) error {
|
|||
dst = newDownloadWriter(fd, resp.ContentLength)
|
||||
}
|
||||
if _, err = io.Copy(dst, resp.Body); err != nil {
|
||||
dst.Close()
|
||||
os.Remove(tmpfile)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue