mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Merge pull request #3491 from oilbeater/fix-defer-in-loop
defer in loop may cause resource leak
This commit is contained in:
commit
86ae040bfa
1 changed files with 2 additions and 1 deletions
|
|
@ -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…
Reference in a new issue