From 0f951956d0b8b4b459a2f46bcd4e7118f0306210 Mon Sep 17 00:00:00 2001 From: linfangrong Date: Thu, 31 Oct 2019 23:17:12 +0800 Subject: [PATCH] [FIX] c.Request.FormFile maybe file, need close (#2114) --- context.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/context.go b/context.go index 18d328d2..046f284e 100644 --- a/context.go +++ b/context.go @@ -516,7 +516,11 @@ func (c *Context) FormFile(name string) (*multipart.FileHeader, error) { return nil, err } } - _, fh, err := c.Request.FormFile(name) + f, fh, err := c.Request.FormFile(name) + if err != nil { + return nil, err + } + f.Close() return fh, err }