Get closer to being able to run t4203-mailmap.sh by fixing a couple of memory leak in mailmap.c. In the free_mailmap_entry() code added in 0925ce4d49 (Add map_user() and clear_mailmap() to mailmap, 2009-02-08) the intent was clearly to clear the "me" structure, but while we freed parts of the mailmap_entry structure, we didn't free the structure itself. The same goes for the "mailmap_info" structure. --- mailmap.c | 2 ++ t/t4203-mailmap.sh | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/mailmap.c b/mailmap.c index d1f7c0d272..e1c8736093 100644 --- a/mailmap.c +++ b/mailmap.c @@ -36,6 +36,7 @@ static void free_mailmap_info(void *p, const char *s) s, debug_str(mi->name), debug_str(mi->email)); free(mi->name); free(mi->email); + free(mi); } static void free_mailmap_entry(void *p, const char *s) @@ -51,6 +52,7 @@ static void free_mailmap_entry(void *p, const char *s) me->namemap.strdup_strings = 1; string_list_clear_func(&me->namemap, free_mailmap_info); + free(me); } /* diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 0b2d21ec55..c7de4299cf 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -79,6 +79,12 @@ test_expect_success 'check-mailmap bogus contact --stdin' ' test_must_fail git check-mailmap --stdin bogus </dev/null ' +if test_have_prereq SANITIZE_LEAK +then + skip_all='skipping the rest of mailmap tests under SANITIZE_LEAK' + test_done +fi + test_expect_success 'No mailmap' ' cat >expect <<-EOF && $GIT_AUTHOR_NAME (1): -- 2.32.0-dev