Commit 35e4c1a7 authored by Matthew Holt's avatar Matthew Holt

Sanity checkL this defer does not leak fds; comment added

parent 25bfdfe9
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment