From b9344dcf82662dc7a122734c1ec4161b8aa0476c Mon Sep 17 00:00:00 2001 From: Meutel Date: Thu, 27 Jul 2017 19:59:43 +0200 Subject: [PATCH] Close uploaded file --- form-ex2/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/form-ex2/main.go b/form-ex2/main.go index 8f4dbeb..01969ed 100644 --- a/form-ex2/main.go +++ b/form-ex2/main.go @@ -31,6 +31,7 @@ func handleForm(res http.ResponseWriter, req *http.Request) error { if err != nil { return err } + defer file.Close() tmpFile, err := os.Create(filepath.Join(os.TempDir(), header.Filename)) if err != nil {