Subject: Re: [PATCH 24/24] revisions API: have release_revisions() release "topo_walk_info"

From: Derrick Stolee <[email-masked]>
Date: Wed, 9 Mar 2022 14:27:54 -0500

On 3/9/2022 8:16 AM, Ævar Arnfjörð Bjarmason wrote:
> Refactor the existing reset_topo_walk() into a thin wrapper for a
> release_revisions_topo_walk_info() + resetting the member to "NULL",
> and call release_revisions_topo_walk_info() from release_revisions().
> 
> This fixes memory leaks that have been with us ever since
> "topo_walk_info" was added to revision.[ch] in
> f0d9cc4196a (revision.c: begin refactoring --topo-order logic,
> 2018-11-01).

Excellent.

> +static void reset_topo_walk(struct rev_info *revs)
> +{
> +	struct topo_walk_info *info = revs->topo_walk_info;

Why add this variable?
  
> -	FREE_AND_NULL(revs->topo_walk_info);
> +	release_revisions_topo_walk_info(info);

For only this use?

	release_revisions_topo_walk_info(revs->topo_walk_info);

seems to work just fine. Is the line too long?

Thanks,
-Stolee