Re: [PATCH 01/14] index-pack: fix memory leaks
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Mar 3, 2022, 16:19 UTC
- Message-ID
- <220303.86r17j2ekz.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <e3ad8853-a33d-a70b-4ace-92873c9d1401@github.com>
On Wed, Mar 02 2022, Derrick Stolee wrote:
Show 8 quoted lines
> On 3/2/2022 12:10 PM, Ævar Arnfjörð Bjarmason wrote: >> Fix various memory leaks in "git index-pack", due to how tightly >> coupled this command is with the revision walking this doesn't make >> any new tests pass, but e.g. this now passes, and had several failures before: >> >> ./t5300-pack-object.sh --run=1-2,4,6-27,30-42 > > Do you mean that these tests now pass under leak check?
Yes, i.e. test 3, 5 etc. fails before & after, and this change makes tests in these ranges pass.
>> it is a bit odd that we'll free "opts.anomaly", since the "opts" is a > > s/it/It/
Thanks, will fix!
Show 10 quoted lines
>> "struct pack_idx_option" declared in pack.h. In pack-write.c there's a >> reset_pack_idx_option(), but it only wipes the contents, but doesn't >> free() anything. >> >> Doing this here in cmd_index_pack() is correct because while the >> struct is declared in pack.h, this code in builtin/index-pack.c (in >> read_v2_anomalous_offsets()) is what allocates the "opts.anomaly", so >> we should also free it here. > > Makes sense. Code diff looks good.
Thanks!