From 4e85c8e0d8db6171b34b2fa331c4a6eb86f45281 Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Wed, 16 Oct 2019 20:32:15 +0100
Subject: [PATCH] Add missed close in ServeBlobLFS (#8527) (#8542)

---
 routers/repo/download.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/routers/repo/download.go b/routers/repo/download.go
index 2da8b109ca..6f10fe36a3 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -84,6 +84,11 @@ func ServeBlobOrLFS(ctx *context.Context, blob *git.Blob) error {
 		if err != nil {
 			return err
 		}
+		defer func() {
+			if err = lfsDataRc.Close(); err != nil {
+				log.Error("ServeBlobOrLFS: Close: %v", err)
+			}
+		}()
 		return ServeData(ctx, ctx.Repo.TreePath, lfsDataRc)
 	}