Skip to content

Commit

Permalink
leak opened file
Browse files Browse the repository at this point in the history
should defer file.Close()
  • Loading branch information
cloudzhou authored Sep 27, 2019
1 parent 11774c8 commit 5a5482c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions utils/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ func (e *Email) AttachFile(args ...string) (a *Attachment, err error) {
if err != nil {
return
}
defer f.Close()
ct := mime.TypeByExtension(filepath.Ext(filename))
basename := path.Base(filename)
return e.Attach(f, basename, ct, id)
Expand Down

0 comments on commit 5a5482c

Please sign in to comment.