diff options
author | Kyungmin Bae <kyungmin.bae@devsisters.com> | 2020-05-24 02:29:58 +0900 |
---|---|---|
committer | Kyungmin Bae <kyungmin.bae@devsisters.com> | 2020-05-24 02:29:58 +0900 |
commit | 10199949b9e5a71f72241c4bb23f3d733287065c (patch) | |
tree | 52b3efdb1944d9c833522d32a0af5c4b275a3ab6 /plumbing/format/packfile/packfile.go | |
parent | 6d8103df45ce09ffd5323b4ef46d26440400a54f (diff) | |
download | go-git-10199949b9e5a71f72241c4bb23f3d733287065c.tar.gz |
Close Reader & Writer of EncodedObject after use
Diffstat (limited to 'plumbing/format/packfile/packfile.go')
-rw-r--r-- | plumbing/format/packfile/packfile.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plumbing/format/packfile/packfile.go b/plumbing/format/packfile/packfile.go index d060041..ddd7f62 100644 --- a/plumbing/format/packfile/packfile.go +++ b/plumbing/format/packfile/packfile.go @@ -10,6 +10,7 @@ import ( "github.com/go-git/go-git/v5/plumbing/cache" "github.com/go-git/go-git/v5/plumbing/format/idxfile" "github.com/go-git/go-git/v5/plumbing/storer" + "github.com/go-git/go-git/v5/utils/ioutil" ) var ( @@ -307,12 +308,14 @@ func (p *Packfile) getNextMemoryObject(h *ObjectHeader) (plumbing.EncodedObject, return obj, nil } -func (p *Packfile) fillRegularObjectContent(obj plumbing.EncodedObject) error { +func (p *Packfile) fillRegularObjectContent(obj plumbing.EncodedObject) (err error) { w, err := obj.Writer() if err != nil { return err } + defer ioutil.CheckClose(w, &err) + _, _, err = p.s.NextObject(w) p.cachePut(obj) |