defer in loop may cause resource leak

pull/3491/head
oilbeater 7 years ago
parent 460dbe937e
commit 757db3a062

@ -63,11 +63,12 @@ func Expand(dir string, r io.Reader) error {
if err != nil {
return err
}
defer file.Close()
_, err = io.Copy(file, tr)
if err != nil {
file.Close()
return err
}
file.Close()
}
return nil
}

Loading…
Cancel
Save