summaryrefslogtreecommitdiffstats
path: root/modules/lfs/locks.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/lfs/locks.go')
-rw-r--r--modules/lfs/locks.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/lfs/locks.go b/modules/lfs/locks.go
index d7b2429698..9ffe6b9d59 100644
--- a/modules/lfs/locks.go
+++ b/modules/lfs/locks.go
@@ -155,7 +155,9 @@ func PostLockHandler(ctx *context.Context) {
}
var req api.LFSLockRequest
- dec := json.NewDecoder(ctx.Req.Body().ReadCloser())
+ bodyReader := ctx.Req.Body().ReadCloser()
+ defer bodyReader.Close()
+ dec := json.NewDecoder(bodyReader)
if err := dec.Decode(&req); err != nil {
writeStatus(ctx, 400)
return
@@ -269,7 +271,9 @@ func UnLockHandler(ctx *context.Context) {
}
var req api.LFSLockDeleteRequest
- dec := json.NewDecoder(ctx.Req.Body().ReadCloser())
+ bodyReader := ctx.Req.Body().ReadCloser()
+ defer bodyReader.Close()
+ dec := json.NewDecoder(bodyReader)
if err := dec.Decode(&req); err != nil {
writeStatus(ctx, 400)
return