Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

plumbing: transport/http, Close http.Body reader when needed #657

Merged
merged 1 commit into from
Nov 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plumbing/transport/http/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down