Re: [PATCH 5/5] builtin/multi-pack-index: de-globalize options handling
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Dec 1, 2026, 17:18 UTC
- Message-ID
- <aw8A3FPmNwUvMoMC@denethor>
- In-Reply-To
- <aw6onR6DqUkKJmzY@pks.im>
On 26/12/01 11:59AM, Patrick Steinhardt wrote:
Show 26 quoted lines
> On Mon, Nov 30, 2026 at 03:55:01PM -0600, Justin Tobler wrote: > > diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c > > index d3881aee6a11..eb5c77456b33 100644 > > --- a/builtin/multi-pack-index.c > > +++ b/builtin/multi-pack-index.c > > @@ -214,6 +216,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv, > > > > string_list_clear(&packs, 0); > > free(opts.refs_snapshot); > > + free(opts.object_dir); > > > > return ret; > > > > @@ -223,6 +226,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv, > > opts.refs_snapshot, opts.flags); > > > > free(opts.refs_snapshot); > > + free(opts.object_dir); > > return ret; > > } > > Okay. Now that the options aren't global anymore we of course have to > free everything they reference. It would have been nice though to unify > the logic a bit, either by introducing a common return path or by > introducing a function that releases the memory held on to by `opts`. Or > both.
With the changes suggested for patch 1, "--object-dir=" no longer needs to be allocated, and consuently no longer needs to be freed. I'll leave the existing handling of `refs_snapshot` as-is for now.
Thanks for the review, -Justin