0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-01-06 22:40:31 -05:00

Sanity checkL this defer does not leak fds; comment added

This commit is contained in:
Matthew Holt 2016-03-12 16:32:12 -07:00
parent 25bfdfe92c
commit 35e4c1a7bf

View file

@ -103,6 +103,8 @@ func (fh *fileHandler) serveFile(w http.ResponseWriter, r *http.Request, name st
index := strings.TrimSuffix(name, "/") + "/" + indexPage
ff, err := fh.root.Open(index)
if err == nil {
// this defer does not leak fds because previous iterations
// of the loop must have had an err, so nothing to close
defer ff.Close()
dd, err := ff.Stat()
if err == nil {