mirror of
https://github.com/helm/helm.git
synced 2026-08-13 17:07:28 +00:00
Merge pull request #3491 from oilbeater/fix-defer-in-loop
defer in loop may cause resource leak
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user