mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-15 04:26:37 +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)
|
dst = newDownloadWriter(fd, resp.ContentLength)
|
||||||
}
|
}
|
||||||
if _, err = io.Copy(dst, resp.Body); err != nil {
|
if _, err = io.Copy(dst, resp.Body); err != nil {
|
||||||
|
dst.Close()
|
||||||
os.Remove(tmpfile)
|
os.Remove(tmpfile)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue