diff --git a/add-interactive.c b/add-interactive.c index 7247210301..54cdfc8201 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -570,6 +570,7 @@ static int get_modified_files(struct repository *r, if (ps) clear_pathspec(&rev.prune_data); + release_revisions(&rev); } hashmap_clear_and_free(&s.file_map, struct pathname_entry, ent); if (unmerged_count) diff --git a/bisect.c b/bisect.c index 9e6a2b7f20..cc6b8b6230 100644 --- a/bisect.c +++ b/bisect.c @@ -884,6 +884,7 @@ static int check_ancestors(struct repository *r, int rev_nr, /* Clean up objects used, as they will be reused. */ clear_commit_marks_many(rev_nr, rev, ALL_REV_FLAGS); + release_revisions(&revs); return res; } @@ -964,6 +965,7 @@ static void show_diff_tree(struct repository *r, setup_revisions(ARRAY_SIZE(argv) - 1, argv, &opt, NULL); log_tree_commit(&opt, commit); + release_revisions(&opt); } /* diff --git a/builtin/add.c b/builtin/add.c index 3ffb86a433..f507d2191c 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -340,6 +340,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix) unlink(file); free(file); + release_revisions(&rev); return 0; } diff --git a/builtin/am.c b/builtin/am.c index 0f4111bafa..93bec62afa 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1397,6 +1397,7 @@ static void write_commit_patch(const struct am_state *state, struct commit *comm add_pending_object(&rev_info, &commit->object, ""); diff_setup_done(&rev_info.diffopt); log_tree_commit(&rev_info, commit); + release_revisions(&rev_info); } /** @@ -1429,6 +1430,7 @@ static void write_index_patch(const struct am_state *state) add_pending_object(&rev_info, &tree->object, ""); diff_setup_done(&rev_info.diffopt); run_diff_index(&rev_info, 1); + release_revisions(&rev_info); } /** @@ -1582,6 +1584,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa add_pending_oid(&rev_info, "HEAD", &our_tree, 0); diff_setup_done(&rev_info.diffopt); run_diff_index(&rev_info, 1); + release_revisions(&rev_info); } if (run_apply(state, index_path)) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 8b2b259ff0..e4d7b6779a 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -555,6 +555,7 @@ static int bisect_skipped_commits(struct bisect_terms *terms) reset_revision_walk(); strbuf_release(&commit_name); + release_revisions(&revs); fclose(fp); return 0; } @@ -1041,6 +1042,7 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, const char **ar oid_to_hex(&commit->object.oid)); reset_revision_walk(); + release_revisions(&revs); } else { strvec_push(&argv_state, argv[i]); } diff --git a/builtin/blame.c b/builtin/blame.c index 885b381ab8..24bac822c5 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1203,5 +1203,6 @@ parse_done: cleanup: cleanup_scoreboard(&sb); + release_revisions(&revs); return 0; } diff --git a/builtin/checkout.c b/builtin/checkout.c index 4d9e0bd3ac..7ad4a7113c 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1082,6 +1082,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne /* Clean up objects used, as they will be reused. */ repo_clear_commit_marks(the_repository, ALL_REV_FLAGS); + release_revisions(&revs); } static int switch_branches(const struct checkout_opts *opts, diff --git a/builtin/commit.c b/builtin/commit.c index 009a1de0a3..c7eda9bbb7 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1123,6 +1123,7 @@ static const char *find_author_by_nickname(const char *name) strbuf_release(&buf); format_commit_message(commit, "%aN <%aE>", &buf, &ctx); clear_mailmap(&mailmap); + release_revisions(&revs); return strbuf_detach(&buf, NULL); } die(_("--author '%s' is not 'Name ' and matches no existing author"), name); diff --git a/builtin/describe.c b/builtin/describe.c index 42159cd26b..a76f1a1a7a 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -517,6 +517,7 @@ static void describe_blob(struct object_id oid, struct strbuf *dst) traverse_commit_list(&revs, process_commit, process_object, &pcd); reset_revision_walk(); + release_revisions(&revs); } static void describe(const char *arg, int last_one) @@ -667,6 +668,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix) suffix = NULL; else suffix = dirty; + release_revisions(&revs); } describe("HEAD", 1); } else if (dirty) { diff --git a/builtin/fast-export.c b/builtin/fast-export.c index a7d72697fb..f34ae451ee 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -1275,6 +1275,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) printf("done\n"); refspec_clear(&refspecs); + release_revisions(&revs); return 0; } diff --git a/builtin/merge.c b/builtin/merge.c index f178f5a3ee..d9784d4891 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -443,6 +443,7 @@ static void squash_message(struct commit *commit, struct commit_list *remotehead } write_file_buf(git_path_squash_msg(the_repository), out.buf, out.len); strbuf_release(&out); + release_revisions(&rev); } static void finish(struct commit *head_commit, @@ -998,6 +999,7 @@ static int evaluate_result(void) */ cnt += count_unmerged_entries(); + release_revisions(&rev); return cnt; } diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 09680fb6a8..5c3f317649 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -4167,11 +4167,13 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) read_object_list_from_stdin(); } else if (pfd.have_revs) { get_object_list(&pfd.revs, rp.nr, rp.v); + release_revisions(&pfd.revs); } else { struct rev_info revs; repo_init_revisions(the_repository, &revs, NULL); get_object_list(&revs, rp.nr, rp.v); + release_revisions(&revs); } cleanup_preferred_base(); if (include_tag && nr_result) diff --git a/builtin/prune.c b/builtin/prune.c index c2bcdc07db..df376b2ed1 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -196,5 +196,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix) prune_shallow(show_only ? PRUNE_SHOW_ONLY : 0); } + release_revisions(&revs); return 0; } diff --git a/builtin/reflog.c b/builtin/reflog.c index 9407f835cb..592d5d3344 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -248,6 +248,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix) if (verbose) printf(_("Marking reachable objects...")); mark_reachable_objects(&revs, 0, 0, NULL); + release_revisions(&revs); if (verbose) putchar('\n'); } diff --git a/builtin/shortlog.c b/builtin/shortlog.c index fcde07c936..35825f075e 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -422,6 +422,8 @@ parse_done: else get_from_rev(&rev, &log); + release_revisions(&rev); + shortlog_output(&log); if (log.file != stdout) fclose(log.file); diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 5301612d24..24980863f6 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1269,6 +1269,7 @@ static int compute_summary_module_list(struct object_id *head_oid, run_diff_files(&rev, 0); prepare_submodule_summary(info, &list); strvec_clear(&diff_args); + release_revisions(&rev); return 0; } diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c index baca57d5b6..f48f44f9cd 100644 --- a/fmt-merge-msg.c +++ b/fmt-merge-msg.c @@ -699,6 +699,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out, shortlog(origins.items[i].string, origins.items[i].util, head, &rev, opts, out); + release_revisions(&rev); } strbuf_complete_line(out); diff --git a/merge-ort.c b/merge-ort.c index 8545354daf..4c0d4eba19 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -1594,6 +1594,7 @@ static int find_first_merges(struct repository *repo, } object_array_clear(&merges); + release_revisions(&revs); return result->nr; } diff --git a/merge-recursive.c b/merge-recursive.c index 32bbba5fbb..acd13b2b06 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1160,6 +1160,7 @@ static int find_first_merges(struct repository *repo, } object_array_clear(&merges); + release_revisions(&revs); return result->nr; } diff --git a/midx.c b/midx.c index 865170bad0..702c8a9b17 100644 --- a/midx.c +++ b/midx.c @@ -1061,6 +1061,7 @@ static struct commit **find_commits_for_midx_bitmap(uint32_t *indexed_commits_nr if (indexed_commits_nr_p) *indexed_commits_nr_p = cb.commits_nr; + release_revisions(&revs); return cb.commits; } diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index cab3eaa2ac..ea8e0b51cd 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -326,6 +326,7 @@ next: trace2_data_intmax("pack-bitmap-write", the_repository, "num_maximal_commits", num_maximal); + release_revisions(&revs); free_commit_list(reusable); } diff --git a/ref-filter.c b/ref-filter.c index 7838bd22b8..a91688bbf1 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -2392,6 +2392,7 @@ static void reach_filter(struct ref_array *array, clear_commit_marks(merge_commit, ALL_REV_FLAGS); } + release_revisions(&revs); free(to_clear); } diff --git a/remote.c b/remote.c index 42a4e7106e..fa3152a5d5 100644 --- a/remote.c +++ b/remote.c @@ -2172,6 +2172,7 @@ static int stat_branch_pair(const char *branch_name, const char *base, clear_commit_marks(theirs, ALL_REV_FLAGS); strvec_clear(&argv); + release_revisions(&revs); return 1; } diff --git a/sequencer.c b/sequencer.c index a1bb39383d..f9d7acd106 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1347,6 +1347,7 @@ void print_commit_summary(struct repository *r, log_tree_commit(&rev, commit); } + release_revisions(&rev); strbuf_release(&format); } @@ -3415,6 +3416,7 @@ static int make_patch(struct repository *r, unuse_commit_buffer(commit, commit_buffer); } strbuf_release(&buf); + release_revisions(&log_tree_opt); return res; } @@ -4525,6 +4527,7 @@ cleanup_head_ref: &log_tree_opt.diffopt); log_tree_diff_flush(&log_tree_opt); } + release_revisions(&log_tree_opt); } flush_rewritten_pending(); if (!stat(rebase_path_rewritten_list(), &st) && diff --git a/shallow.c b/shallow.c index 71e5876f37..2552f139f6 100644 --- a/shallow.c +++ b/shallow.c @@ -261,6 +261,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av, if ((o->flags & both_flags) == both_flags) o->flags &= ~not_shallow_flag; } + release_revisions(&revs); return result; } diff --git a/submodule.c b/submodule.c index 7797e5a4db..86ebd3f35c 100644 --- a/submodule.c +++ b/submodule.c @@ -900,9 +900,11 @@ static void collect_changed_submodules(struct repository *r, diff_rev.diffopt.format_callback_data = &data; diff_rev.dense_combined_merges = 1; diff_tree_combined_merge(commit, &diff_rev); + release_revisions(&diff_rev); } reset_revision_walk(); + release_revisions(&rev); } static void free_submodules_oids(struct string_list *submodules) diff --git a/t/helper/test-revision-walking.c b/t/helper/test-revision-walking.c index 625b2dbf82..4a45d5bac2 100644 --- a/t/helper/test-revision-walking.c +++ b/t/helper/test-revision-walking.c @@ -43,6 +43,7 @@ static int run_revision_walk(void) } reset_revision_walk(); + release_revisions(&rev); return got_revision; } diff --git a/wt-status.c b/wt-status.c index 922cf787f9..f910062137 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1152,6 +1152,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s) rev.diffopt.b_prefix = "w/"; run_diff_files(&rev, 0); } + release_revisions(&rev); } static void wt_longstatus_print_tracking(struct wt_status *s)