mirror of
https://github.com/ostreedev/ostree.git
synced 2025-09-03 21:44:16 +03:00
repo: Correctly initialize refcount of temporary transaction
Previously, the reference count was left uninitialized as a result of
bypassing the constructor, and the intended abort-on-error usually
wouldn't have happened.
Fixes: 8a9737a
"repo/private: move OstreeRepoAutoTransaction to a boxed type"
Resolves: https://github.com/ostreedev/ostree/issues/2592
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
@@ -1689,10 +1689,10 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
|
|||||||
g_debug ("Preparing transaction in repository %p", self);
|
g_debug ("Preparing transaction in repository %p", self);
|
||||||
|
|
||||||
/* Set up to abort the transaction if we return early from this function.
|
/* Set up to abort the transaction if we return early from this function.
|
||||||
* This needs to be manually built here due to a circular dependency. */
|
* We can't call _ostree_repo_auto_transaction_start() here, because that
|
||||||
g_autoptr(OstreeRepoAutoTransaction) txn = g_malloc(sizeof(OstreeRepoAutoTransaction));
|
* would be a circular dependency; use the lower-level version instead. */
|
||||||
|
g_autoptr(OstreeRepoAutoTransaction) txn = _ostree_repo_auto_transaction_new (self);
|
||||||
g_assert (txn != NULL);
|
g_assert (txn != NULL);
|
||||||
txn->repo = self;
|
|
||||||
|
|
||||||
memset (&self->txn.stats, 0, sizeof (OstreeRepoTransactionStats));
|
memset (&self->txn.stats, 0, sizeof (OstreeRepoTransactionStats));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user