Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

Commit 6196634

Browse files
mrexodialafriks
authored andcommitted
Improve memory usage in Commit.IsImageFile (#95)
Signed-off-by: Duncan Ogilvie <[email protected]>
1 parent c2040d5 commit 6196634

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

commit.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,11 @@ func (c *Commit) IsImageFile(name string) bool {
9898
return false
9999
}
100100

101-
dataRc, err := blob.Data()
101+
dataRc, err := blob.DataAsync()
102102
if err != nil {
103103
return false
104104
}
105+
defer dataRc.Close()
105106
buf := make([]byte, 1024)
106107
n, _ := dataRc.Read(buf)
107108
buf = buf[:n]

0 commit comments

Comments
 (0)