From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3] revision: clear decoration structs during release_revisions()
Date: Thu, 05 Oct 2023 16:00:54 -0700 [thread overview]
Message-ID: <xmqq34yoekt5.fsf@gitster.g> (raw)
In-Reply-To: <20231005213014.GB986467@coredump.intra.peff.net> (Jeff King's message of "Thu, 5 Oct 2023 17:30:14 -0400")
Jeff King <peff@peff.net> writes:
Wow, nested maze of callbacks make my head spin ;-) but they all
look reasonable. Thanks.
> diff --git a/line-log.c b/line-log.c
> index 790ab73212..24a1ecb677 100644
> --- a/line-log.c
> +++ b/line-log.c
> @@ -1327,3 +1327,13 @@ int line_log_filter(struct rev_info *rev)
>
> return 0;
> }
> +
> +static void free_void_line_log_data(void *data)
> +{
> + free_line_log_data(data);
> +}
> +
> +void line_log_free(struct rev_info *rev)
> +{
> + clear_decoration(&rev->line_log_data, free_void_line_log_data);
> +}
> diff --git a/line-log.h b/line-log.h
> index adff361b1b..4291da8d79 100644
> --- a/line-log.h
> +++ b/line-log.h
> @@ -60,4 +60,6 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev,
>
> int line_log_print(struct rev_info *rev, struct commit *commit);
>
> +void line_log_free(struct rev_info *rev);
> +
> #endif /* LINE_LOG_H */
> diff --git a/revision.c b/revision.c
> index e789834dd1..219dc76716 100644
> --- a/revision.c
> +++ b/revision.c
> @@ -3083,6 +3083,11 @@ static void release_revisions_mailmap(struct string_list *mailmap)
>
> static void release_revisions_topo_walk_info(struct topo_walk_info *info);
>
> +static void free_void_commit_list(void *list)
> +{
> + free_commit_list(list);
> +}
> +
> void release_revisions(struct rev_info *revs)
> {
> free_commit_list(revs->commits);
> @@ -3100,6 +3105,10 @@ void release_revisions(struct rev_info *revs)
> diff_free(&revs->pruning);
> reflog_walk_info_release(revs->reflog_info);
> release_revisions_topo_walk_info(revs->topo_walk_info);
> + clear_decoration(&revs->children, free_void_commit_list);
> + clear_decoration(&revs->merge_simplification, free);
> + clear_decoration(&revs->treesame, free);
> + line_log_free(revs);
> }
>
> static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)
> diff --git a/t/t4217-log-limit.sh b/t/t4217-log-limit.sh
> index 6e01e2629c..613f0710e9 100755
> --- a/t/t4217-log-limit.sh
> +++ b/t/t4217-log-limit.sh
> @@ -2,6 +2,7 @@
>
> test_description='git log with filter options limiting the output'
>
> +TEST_PASSES_SANITIZE_LEAK=true
> . ./test-lib.sh
>
> test_expect_success 'setup test' '
next prev parent reply other threads:[~2023-10-05 23:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-05 21:28 [PATCH 0/3] a few more leak fixes Jeff King
2023-10-05 21:29 ` [PATCH 1/3] decorate: add clear_decoration() function Jeff King
2023-10-05 21:30 ` [PATCH 2/3] revision: clear decoration structs during release_revisions() Jeff King
2023-10-05 23:00 ` Junio C Hamano [this message]
2023-10-06 0:51 ` Jeff King
2023-10-06 16:42 ` Junio C Hamano
2023-10-05 21:33 ` [PATCH 3/3] daemon: free listen_addr before returning Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq34yoekt5.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).