Added deferred close to 'http.File' opened (#9443) (#9461)

Signed-off-by: Pablo Caderno <kaderno@gmail.com>
This commit is contained in:
Pablo Caderno 2021-10-06 22:02:46 +11:00 committed by GitHub
parent 5a4c3734b1
commit b878527151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -397,6 +397,7 @@ func New(logger log.Logger, o *Options) *Handler {
fmt.Fprintf(w, "Error opening React index.html: %v", err)
return
}
defer func() { _ = f.Close() }()
idx, err := ioutil.ReadAll(f)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)