aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-11-24 12:57:19 +0100
committerAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-11-24 13:08:44 +0100
commitbef101131cea89abc5780d38ab0d63aef0c13d9c (patch)
tree1109e33f40e2017fa218d6e0f7e15e9a6a14a750 /plumbing/transport
parenta83486f1220f229714e0733368d91679e036fb7e (diff)
downloadgo-git-bef101131cea89abc5780d38ab0d63aef0c13d9c.tar.gz
Close http.Body reader when needed
If we don't do that, all the goroutines opened by the Body Reader are never closed, causing a 'fatal: morestack on g0' error.
Diffstat (limited to 'plumbing/transport')
-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
}