diff options
author | zeripath <art27@cantab.net> | 2019-10-10 18:42:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-10 18:42:28 +0100 |
commit | 6551a9d6ca8ab79fe1460eb9d60a5a0e76110eb3 (patch) | |
tree | 2fe5e28d14acfc2d59e40af7f6844e064932cb89 /modules/lfs/locks.go | |
parent | df2c11a878719719b8600745888c570af93827be (diff) | |
download | gitea-6551a9d6ca8ab79fe1460eb9d60a5a0e76110eb3.tar.gz gitea-6551a9d6ca8ab79fe1460eb9d60a5a0e76110eb3.zip |
Ensure Request Body Readers are closed in LFS server (#8454)
Diffstat (limited to 'modules/lfs/locks.go')
-rw-r--r-- | modules/lfs/locks.go | 8 |
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 |