Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http.go: close form file if copyZeroAlloc fails #1498

Merged
merged 1 commit into from
Mar 3, 2023
Merged

http.go: close form file if copyZeroAlloc fails #1498

merged 1 commit into from
Mar 3, 2023

Conversation

alexandear
Copy link
Contributor

This PR adds a call to close form file in WriteMultipartForm when copy error occured.

The line below shows that we need to call fh.Close():

if err = fh.Close(); err != nil {
	return fmt.Errorf("cannot close form file %q (%q): %w", k, fv.Filename, err)
} 

@erikdubbelboer erikdubbelboer merged commit 4e8c92b into valyala:master Mar 3, 2023
@erikdubbelboer
Copy link
Collaborator

Thanks!

@alexandear alexandear deleted the multipart-file-close branch March 3, 2023 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants