From 1e8dfa38da5236e87ab913d1f8e0b5122e2b0f68 Mon Sep 17 00:00:00 2001 From: Soam Vasani Date: Wed, 22 May 2019 14:41:57 +0100 Subject: [PATCH] router analytics -- close http response body (#1180) --- router/analytics.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/router/analytics.go b/router/analytics.go index 09adb5a6..9c28ed47 100644 --- a/router/analytics.go +++ b/router/analytics.go @@ -56,6 +56,10 @@ func (a *Analytics) run() { continue } - _, _ = http.Post(a.url, "application/json", bytes.NewReader(msgbytes)) + resp, err := http.Post(a.url, "application/json", bytes.NewReader(msgbytes)) + if resp != nil { + // close response body to prevent resources leak + resp.Body.Close() + } } }