Commit 757db3a0 authored by oilbeater's avatar oilbeater

defer in loop may cause resource leak

parent 460dbe93
...@@ -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