Unverified Commit 86ae040b authored by Matthew Fisher's avatar Matthew Fisher Committed by GitHub

Merge pull request #3491 from oilbeater/fix-defer-in-loop

defer in loop may cause resource leak
parents e13eba12 757db3a0
...@@ -63,11 +63,12 @@ func Expand(dir string, r io.Reader) error { ...@@ -63,11 +63,12 @@ func Expand(dir string, r io.Reader) error {
if err != nil { if err != nil {
return err return err
} }
defer file.Close()
_, err = io.Copy(file, tr) _, err = io.Copy(file, tr)
if err != nil { if err != nil {
file.Close()
return err return err
} }
file.Close()
} }
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment