From ddf4b8fad59febfe3759a8404a2e116ec62bfebe Mon Sep 17 00:00:00 2001 From: Julian Daube Date: Fri, 31 Mar 2017 14:43:01 +0200 Subject: [PATCH] changed handling of images slightly --- cmd/apiserver/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/apiserver/main.go b/cmd/apiserver/main.go index 58a5a20..9a14f9f 100644 --- a/cmd/apiserver/main.go +++ b/cmd/apiserver/main.go @@ -104,6 +104,7 @@ func (h Handler) Picture(resp http.ResponseWriter, path []string) { InternalError(resp) return } + defer img.Close() decodedImg, err := jpeg.Decode(img) if err != nil { @@ -260,5 +261,8 @@ func main() { } log.Println("start serving on:", *addr) - log.Fatal(http.ListenAndServe(*addr, Handler{conn, cache.New(cache.NoExpiration, 0)})) + log.Fatal(http.ListenAndServe(*addr, Handler{ + Connection: conn, + cache: cache.New(cache.NoExpiration, 0), + })) }