Re: [PATCH] repack: free existing_cruft array after use
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Oct 9, 2023, 01:24 UTC
- Message-ID
- <ZSNWZ9+Q2eOpy91A@nand.local>
- In-Reply-To
- <20231007172031.GA1524950@coredump.intra.peff.net>
On Sat, Oct 07, 2023 at 01:20:31PM -0400, Jeff King wrote:
Show 15 quoted lines
> On Mon, Oct 02, 2023 at 08:44:32PM -0400, Taylor Blau wrote:
>
> > +static void collapse_small_cruft_packs(FILE *in, size_t max_size,
> > + struct existing_packs *existing)
> > +{
> > + struct packed_git **existing_cruft, *p;
> > + struct strbuf buf = STRBUF_INIT;
> > [...]
> > +
> > + strbuf_release(&buf);
> > +}
>
> Coverity (using the just-merged-to-next version of the workflow file!)
> flagged a leak here. Since the topic (tb/repack-max-cruft-size) is in
> 'next', I think we'd want this on top:Woohoo! I'm glad that this is already paying dividends.
Show 7 quoted lines
> -- >8 -- > Subject: [PATCH] repack: free existing_cruft array after use > > We allocate an array of packed_git pointers so that we can sort the list > of cruft packs, but we never free the array, causing a small leak. Note > that we don't need to free the packed_git structs themselves; they're > owned by the repository object.
Thanks, I can't believe I missed this when writing this function. The fix looks obviously correct to me, so this has my:
Acked-by: Taylor Blau <me@ttaylorr.com>
Thanks, Taylor