Re: [PATCH v2 04/24] submodule--helper: fix most "struct pathspec" memory leaks
From: Glen Choo <hidden>
Date: 2022-07-21 17:49:59
Ævar Arnfjörð Bjarmason [off-list ref] writes:
quoted hunk ↗ jump to hunk
Call clear_pathspec() at the end of various functions that work with and allocate a "struct pathspec". Signed-off-by: Ævar Arnfjörð Bjarmason <redacted> --- builtin/submodule--helper.c | 115 +++++++++++++++++++++++++----------- 1 file changed, 81 insertions(+), 34 deletions(-)diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index b36919b66c5..28c5fdb8954 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c@@ -1105,7 +1129,7 @@ static int compute_summary_module_list(struct object_id *head_oid, struct strvec diff_args = STRVEC_INIT; struct rev_info rev; struct module_cb_list list = MODULE_CB_LIST_INIT; - int ret = 0; + int ret; strvec_push(&diff_args, get_diff_cmd(diff_cmd)); if (info->cached)@@ -1145,6 +1169,7 @@ static int compute_summary_module_list(struct object_id *head_oid, else run_diff_files(&rev, 0); prepare_submodule_summary(info, &list); + ret = 0; cleanup: strvec_clear(&diff_args); release_revisions(&rev);
This function doesn't use a pathspec at all. Was it changed for consistency reasons or perhaps an accidental inclusion? All the other hunks look correct.