Re: [PATCH 24/24] revisions API: have release_revisions() release "topo_walk_info"
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Mar 9, 2022, 19:27 UTC
- Message-ID
- <ea05408a-bf77-e03d-c367-54d4c6c3c3c6@github.com>
- In-Reply-To
- <patch-24.24-e02a097b884-20220309T123321Z-avarab@gmail.com>
On 3/9/2022 8:16 AM, Ævar Arnfjörð Bjarmason wrote:
Show 8 quoted lines
> 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