Add cleanup multipart form on defer

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2021-01-26 11:35:05 +03:00
parent 462de45e12
commit 0346db462b
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2

View file

@ -64,6 +64,12 @@ func (a *app) upload(c *fasthttp.RequestCtx) {
log.Debug("close temporary file", zap.Error(tmp.Close()))
log.Debug("remove temporary file", zap.Error(os.RemoveAll(tmpName)))
if form == nil {
return
}
log.Debug("cleanup multipart form", zap.Error(form.RemoveAll()))
}()
if form, err = c.MultipartForm(); err != nil {