Re: [PATCH v2 07/11] odb/transaction: propagate commit errors
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 8, 2026, 06:41 UTC
- Message-ID
- <ak3xKlQTPP5OXYRn@pks.im>
- In-Reply-To
- <20260708041412.1157499-8-jltobler@gmail.com>
On Tue, Jul 07, 2026 at 11:14:08PM -0500, Justin Tobler wrote:
Show 32 quoted lines
> diff --git a/odb/transaction.c b/odb/transaction.c
> index df4275151b..51af2c9a61 100644
> --- a/odb/transaction.c
> +++ b/odb/transaction.c
> @@ -16,19 +16,26 @@ int odb_transaction_begin(struct object_database *odb,
> return ret;
> }
>
> -void odb_transaction_commit(struct odb_transaction *transaction)
> +int odb_transaction_commit(struct odb_transaction *transaction)
> {
> + int ret;
> +
> if (!transaction)
> - return;
> + return 0;
>
> /*
> * Ensure the transaction ending matches the pending transaction.
> */
> ASSERT(transaction == transaction->source->odb->transaction);
>
> - transaction->commit(transaction);
> + ret = transaction->commit(transaction);
> + if (ret)
> + return ret;
> +
> transaction->source->odb->transaction = NULL;
> free(transaction);
> +
> + return 0;
> }Doesn't this cause a leak now?
I think this interface here is doing the same mistake that our reference transactions did, where we automatically released the transaction on commit. That caused multiple lifetime issues with references all over the place.
This isn't an issue introduced by this patch series though, so it's fine to ignore this for now.
Patrick