@@ -757,6 +757,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)
opt.revarg_opt = REVARG_COMMITTISH;
opt.tweak = log_setup_revisions_tweak;
cmd_log_init(argc, argv, prefix, &rev, &opt);
+ UNLEAK(rev);
return cmd_log_walk(&rev);
}
@@ -3759,6 +3759,7 @@ static void get_object_list(int ac, const char **av)
if (handle_revision_arg(line, &revs, flags, REVARG_CANNOT_BE_FILENAME))
die(_("bad revision '%s'"), line);
}
+ UNLEAK(revs);
warn_on_object_refname_ambiguity = save_warning;
@@ -549,6 +549,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
argc = setup_revisions(argc, argv, &revs, &s_r_opt);
+ UNLEAK(revs);
+
memset(&info, 0, sizeof(info));
info.revs = &revs;
if (revs.bisect)
@@ -234,6 +234,8 @@ static void bitmap_builder_init(struct bitmap_builder *bb,
if (prepare_revision_walk(&revs))
die("revision walk setup failed");
+ UNLEAK(revs);
+
while ((commit = get_revision(&revs))) {
struct commit_list *p = commit->parents;
struct bb_commit *c_ent;
@@ -3,6 +3,7 @@
test_description='multi-pack-indexes'
. ./test-lib.sh
+TEST_PASSES_SANITIZE_LEAK=true
GIT_TEST_MULTI_PACK_INDEX=0
objdir=.git/objects
This resolves the remaining leaks uncovered by running t5319 when building with SANITIZE=leak. All of the leaks below are related to allocated memory stored in 'struct rev_info' which is never freed. We could alternatively implement a function which frees all allocated memory associated with the rev_info struct, but doing this properly is a bigger undertaking than I want to deal with right now. Instead, let's just UNLEAK() the few ones that are holding up t5319, which enables us to mark that test as TEST_PASSES_SANITIZE_LEAK. Signed-off-by: Taylor Blau <me@ttaylorr.com> --- builtin/log.c | 1 + builtin/pack-objects.c | 1 + builtin/rev-list.c | 2 ++ pack-bitmap-write.c | 2 ++ t/t5319-multi-pack-index.sh | 1 + 5 files changed, 7 insertions(+)