aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-11-24 13:12:41 +0100
committerGitHub <noreply@github.com>2017-11-24 13:12:41 +0100
commitd92d437af0fb23865c79e45b4acd3d7544593260 (patch)
tree1109e33f40e2017fa218d6e0f7e15e9a6a14a750
parenta83486f1220f229714e0733368d91679e036fb7e (diff)
parentbef101131cea89abc5780d38ab0d63aef0c13d9c (diff)
downloadgo-git-d92d437af0fb23865c79e45b4acd3d7544593260.tar.gz
Merge pull request #657 from ajnavarro/fix/close-http-response
plumbing: transport/http, Close http.Body reader when needed
-rw-r--r--plumbing/transport/http/common.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/plumbing/transport/http/common.go b/plumbing/transport/http/common.go
index 10a267a..edf1c6c 100644
--- a/plumbing/transport/http/common.go
+++ b/plumbing/transport/http/common.go
@@ -10,6 +10,7 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp"
"gopkg.in/src-d/go-git.v4/plumbing/transport"
+ "gopkg.in/src-d/go-git.v4/utils/ioutil"
)
// it requires a bytes.Buffer, because we need to know the length
@@ -45,8 +46,9 @@ func advertisedReferences(s *session, serviceName string) (*packp.AdvRefs, error
return nil, err
}
+ defer ioutil.CheckClose(res.Body, &err)
+
if err := NewErr(res); err != nil {
- _ = res.Body.Close()
return nil, err
}