From 269286192d4aa947f2a6c779c2f59f4873ec5616 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Wed, 29 Apr 2015 18:31:01 -0700 Subject: [PATCH] Address possible goroutine leak in notification library Signed-off-by: Stephen J Day --- notifications/http.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notifications/http.go b/notifications/http.go index 15b3574cf..465434f1c 100644 --- a/notifications/http.go +++ b/notifications/http.go @@ -53,6 +53,7 @@ type httpStatusListener interface { func (hs *httpSink) Write(events ...Event) error { hs.mu.Lock() defer hs.mu.Unlock() + defer hs.client.Transport.(*headerRoundTripper).CloseIdleConnections() if hs.closed { return ErrSinkClosed @@ -83,6 +84,7 @@ func (hs *httpSink) Write(events ...Event) error { return fmt.Errorf("%v: error posting: %v", hs, err) } + defer resp.Body.Close() // The notifier will treat any 2xx or 3xx response as accepted by the // endpoint.