From ac6ede03b38553593cf04185c3d73dadaa7384e3 Mon Sep 17 00:00:00 2001 From: Mike Hobbs Date: Wed, 21 Aug 2019 13:03:29 -0500 Subject: [PATCH 1/3] plugging file descriptor leak in couchdb backend --- physical/couchdb/couchdb.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/physical/couchdb/couchdb.go b/physical/couchdb/couchdb.go index b19a1c933558..b38439fa4405 100644 --- a/physical/couchdb/couchdb.go +++ b/physical/couchdb/couchdb.go @@ -86,7 +86,10 @@ func (m *couchDBClient) put(e couchDBEntry) error { return err } req.SetBasicAuth(m.username, m.password) - _, err = m.Client.Do(req) + resp, err = m.Client.Do(req) + if err == nil { + resp.Body.Close() + } return err } From f6cf62e61ec6a1114cc1dead7f0f641d21645e0b Mon Sep 17 00:00:00 2001 From: Mike Hobbs Date: Wed, 21 Aug 2019 13:15:23 -0500 Subject: [PATCH 2/3] plugging file descriptor leak in couchdb backend - fixed syntax error --- physical/couchdb/couchdb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physical/couchdb/couchdb.go b/physical/couchdb/couchdb.go index b38439fa4405..625286223c7c 100644 --- a/physical/couchdb/couchdb.go +++ b/physical/couchdb/couchdb.go @@ -86,7 +86,7 @@ func (m *couchDBClient) put(e couchDBEntry) error { return err } req.SetBasicAuth(m.username, m.password) - resp, err = m.Client.Do(req) + resp, err := m.Client.Do(req) if err == nil { resp.Body.Close() } From 45f9fa12800d83967b3d4f990cd0ade7ba1dd791 Mon Sep 17 00:00:00 2001 From: Mike Hobbs Date: Wed, 21 Aug 2019 13:27:44 -0500 Subject: [PATCH 3/3] plugging file descriptor leak in couchdb backend - fixed whitespace --- physical/couchdb/couchdb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/physical/couchdb/couchdb.go b/physical/couchdb/couchdb.go index 625286223c7c..8fbfed413a37 100644 --- a/physical/couchdb/couchdb.go +++ b/physical/couchdb/couchdb.go @@ -86,7 +86,7 @@ func (m *couchDBClient) put(e couchDBEntry) error { return err } req.SetBasicAuth(m.username, m.password) - resp, err := m.Client.Do(req) + resp, err := m.Client.Do(req) if err == nil { resp.Body.Close() }