Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Release only finished walks, never cgit's mailmap
release_revisions frees revs->mailmap, and the log page points it at the
static list cgit_mailmap returns, so every log of a repository with
enable-mailmap aborted. A walk whose setup failed holds commits that are
already freed, so releasing it could free them twice.
Diffstat (limited to 'source')
| -rw-r--r-- | source/ui-log.c | 4 | |
| -rw-r--r-- | source/ui-patch.c | 1 | |
| -rw-r--r-- | source/ui-shared.h | 2 | |
| -rw-r--r-- | source/ui-stats.c | 1 |
4 files changed, 4 insertions, 4 deletions
diff --git a/source/ui-log.c b/source/ui-log.c index ef52951..5b3a88a 100644 --- a/source/ui-log.c +++ b/source/ui-log.c @@ -612,8 +612,10 @@ void cgit_print_log(const char *tip, int ofs, int cnt, const char *grep, const c html("</tbody>\n"); } -out: + // The mailmap is cgit's own and outlives the walk. + rev.mailmap = NULL; release_revisions(&rev); +out: if (must_free_tip) free((char *)tip); strvec_clear(&rev_argv); diff --git a/source/ui-patch.c b/source/ui-patch.c index 3c76255..0fa9a2e 100644 --- a/source/ui-patch.c +++ b/source/ui-patch.c @@ -74,7 +74,6 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, const char *pref rev.max_count = ctx.cfg.max_patch_count; // The headers wait until the walk has started. if (cgit_prepare_walk(&rev)) { - release_revisions(&rev); strvec_clear(&rev_argv); return; } diff --git a/source/ui-shared.h b/source/ui-shared.h index 32337d9..cd937a3 100644 --- a/source/ui-shared.h +++ b/source/ui-shared.h @@ -158,7 +158,7 @@ extern int cgit_get_old_oid(const char *old_rev, const struct commit *commit, st /* * Start rev's walk, or print the error page and return non-zero when git * cannot. A failed setup leaves the walk holding freed commits, so the caller - * must not read from it then. + * must then neither read from it nor hand it to release_revisions. */ extern int cgit_prepare_walk(struct rev_info *rev); diff --git a/source/ui-stats.c b/source/ui-stats.c index f3ad25e..ee5b76b 100644 --- a/source/ui-stats.c +++ b/source/ui-stats.c @@ -218,7 +218,6 @@ static int collect_stats(const struct cgit_period *period, struct string_list *a // bounds the period edge exactly. rev.max_age = since; if (cgit_prepare_walk(&rev)) { - release_revisions(&rev); strvec_clear(&argv); return -1; } |
