Re: [PATCH v2 3/6] midx-write: use cleanup when incremental midx fails
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Sep 3, 2025, 10:15 UTC
- Message-ID
- <aLgVMxIeOH_goTG5@pks.im>
- In-Reply-To
- <c4f75cca094dd47c431de52e335ccaaf8b06355b.1756589007.git.gitgitgadget@gmail.com>
On Sat, Aug 30, 2025 at 09:23:24PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 11 quoted lines
> diff --git a/midx-write.c b/midx-write.c
> index 0f1d5653ab..cb0211289d 100644
> --- a/midx-write.c
> +++ b/midx-write.c
> @@ -1327,13 +1327,15 @@ static int write_midx_internal(struct repository *r, const char *object_dir,
> incr = mks_tempfile_m(midx_name.buf, 0444);
> if (!incr) {
> error(_("unable to create temporary MIDX layer"));
> - return -1;
> + result = -1;
> + goto cleanup;We can instead use `result = error(...); goto cleanup;` here and in most other cases.
Patrick