Skip to content

Commit 4e8c92b

Browse files
authored
http.go: close form file if copyZeroAlloc fails (#1498)
1 parent 8800d4b commit 4e8c92b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

http.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,7 @@ func WriteMultipartForm(w io.Writer, f *multipart.Form, boundary string) error {
992992
return fmt.Errorf("cannot open form file %q (%q): %w", k, fv.Filename, err)
993993
}
994994
if _, err = copyZeroAlloc(vw, fh); err != nil {
995+
_ = fh.Close()
995996
return fmt.Errorf("error when copying form file %q (%q): %w", k, fv.Filename, err)
996997
}
997998
if err = fh.Close(); err != nil {

0 commit comments

Comments
 (0)