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:
parent
25bfdfe92c
commit
35e4c1a7bf
1 changed files with 2 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue