From 619663493e5490af2a32608ddd6e6762f98e0718 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Tue, 28 Nov 2017 16:24:08 +0100 Subject: [PATCH] Improve memory usage in Commit.IsImageFile (#95) Signed-off-by: Duncan Ogilvie --- commit.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commit.go b/commit.go index c2954123816e3..299a2381b65b6 100644 --- a/commit.go +++ b/commit.go @@ -98,10 +98,11 @@ func (c *Commit) IsImageFile(name string) bool { return false } - dataRc, err := blob.Data() + dataRc, err := blob.DataAsync() if err != nil { return false } + defer dataRc.Close() buf := make([]byte, 1024) n, _ := dataRc.Read(buf) buf = buf[:n]