]> source.dussan.org Git - gitea.git/commit
Fix missing close in WalkGitLog (#17008)
authorzeripath <art27@cantab.net>
Fri, 10 Sep 2021 09:46:12 +0000 (10:46 +0100)
committerGitHub <noreply@github.com>
Fri, 10 Sep 2021 09:46:12 +0000 (17:46 +0800)
commit0faf175694e5692d933d06b07d87dedd2b6e55f5
treec06714cd2e69601bace078ecba9f33ef4c72afdb
parent248b96d8a38b2d52a73d7091a82f688f4688295e
Fix missing close in WalkGitLog (#17008)

When the external context is cancelled it is possible for the
GitLogReader to not itself be Closed.

This PR does three things:

1. Instead of adding a plain defer it wraps the `g.Close` in a func as
`g` may change.
2. It adds the missing explicit g.Close - although the defer fix makes
this unnecessary.
3. It passes down the external context as the base context for the
GitLogReader meaning that the cancellation of the external context will
pass down automatically.

Fix #17007

Signed-off-by: Andrew Thornton <art27@cantab.net>
modules/git/log_name_status.go