From: Patrick Steinhardt Date: Tue, 01 Dec 2026 10:59:41 GMT Subject: Re: [PATCH 5/5] builtin/multi-pack-index: de-globalize options handling Message-ID: In-Reply-To: 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. > @@ -404,8 +424,5 @@ int cmd_multi_pack_index(int argc, > argc = parse_options(argc, argv, prefix, options, > builtin_multi_pack_index_usage, 0); > > - res = fn(argc, argv, prefix, repo); > - > - free(opts.object_dir); > - return res; > + return fn(argc, argv, prefix, repo); Ah, no, not quite. We did free it, but in the global function. Quite ugly, so good that we're getting rid of this now. Thanks! Patrick