summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--builtin/submodule--helper.c21
-rwxr-xr-xt/t7401-submodule-summary.sh1
2 files changed, 21 insertions, 1 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index c95098e621..3453faabd3 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -748,16 +748,34 @@ struct module_cb {
struct object_id oid_src;
struct object_id oid_dst;
char status;
- const char *sm_path;
+ char *sm_path;
};
#define MODULE_CB_INIT { 0 }
+static void module_cb_release(struct module_cb *mcb)
+{
+ free(mcb->sm_path);
+}
+
struct module_cb_list {
struct module_cb **entries;
int alloc, nr;
};
#define MODULE_CB_LIST_INIT { 0 }
+static void module_cb_list_release(struct module_cb_list *mcbl)
+{
+ int i;
+
+ for (i = 0; i < mcbl->nr; i++) {
+ struct module_cb *mcb = mcbl->entries[i];
+
+ module_cb_release(mcb);
+ free(mcb);
+ }
+ free(mcbl->entries);
+}
+
struct summary_cb {
int argc;
const char **argv;
@@ -1101,6 +1119,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
cleanup:
strvec_clear(&diff_args);
release_revisions(&rev);
+ module_cb_list_release(&list);
return ret;
}
diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
index 9c3cc4cf40..542b3331a7 100755
--- a/t/t7401-submodule-summary.sh
+++ b/t/t7401-submodule-summary.sh
@@ -17,6 +17,7 @@ This test script tries to verify the sanity of summary subcommand of git submodu
# various reasons, one of them being that there are lots of commands taking place
# outside of 'test_expect_success' block, which is no longer in good-style.
+TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
add_file () {