On Thu, Oct 31, 2024 at 06:27:00AM +0000, Derrick Stolee via GitGitGadget wrote: [snip] > +int cmd__path_walk(int argc, const char **argv) > +{ > + int res; > + struct rev_info revs = REV_INFO_INIT; > + struct path_walk_info info = PATH_WALK_INFO_INIT; > + struct path_walk_test_data data = { 0 }; > + struct option options[] = { > + OPT_END(), > + }; > + > + initialize_repository(the_repository); > + setup_git_directory(); > + revs.repo = the_repository; > + > + argc = parse_options(argc, argv, NULL, > + options, path_walk_usage, > + PARSE_OPT_KEEP_UNKNOWN_OPT | PARSE_OPT_KEEP_ARGV0); > + > + if (argc > 1) > + setup_revisions(argc, argv, &revs, NULL); > + else > + usage(path_walk_usage[0]); > + > + info.revs = &revs; > + info.path_fn = emit_block; > + info.path_fn_data = &data; > + > + res = walk_objects_by_path(&info); > + > + printf("trees:%" PRIuMAX "\n" > + "blobs:%" PRIuMAX "\n", > + data.tree_nr, data.blob_nr); > + > + return res; > +} This function is leaking memory. I'd propose to add below patch on top to plug them, which makes t6601 pass with the leak sanitizer enabled. Patrick diff --git a/t/helper/test-path-walk.c b/t/helper/test-path-walk.c index 06b103d876..fa3bfe46b5 100644 --- a/t/helper/test-path-walk.c +++ b/t/helper/test-path-walk.c @@ -85,7 +85,6 @@ int cmd__path_walk(int argc, const char **argv) OPT_END(), }; - initialize_repository(the_repository); setup_git_directory(); revs.repo = the_repository; @@ -110,5 +109,6 @@ int cmd__path_walk(int argc, const char **argv) "tags:%" PRIuMAX "\n", data.commit_nr, data.tree_nr, data.blob_nr, data.tag_nr); + release_revisions(&revs); return res; }