mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-23 21:35:26 +03:00
lib/commit: Unref repo on success
Commit540e60c3
introduced _ostree_repo_auto_transaction_new(), a private constructor to OstreeRepoAutoTransaction, by factoring out some code from _ostree_repo_auto_transaction_start(). This factored code increased the refcount of the 'repo' variable. Subsequent commit71304e854c
made ostree_repo_prepare_transaction() use ths newly introduced constructor. However, in this function, the happy path assumed no ref was taken, and therefore did not unref it. Commit71304e854c
didn't add the corresponding unref either. This leaks a reference to OstreeRepo when calling ostree_repo_prepare_transaction(). Plug this leak by using g_clear_object() to clear the repo field of OstreeRepoAutoTransaction, instead of simply setting it to NULL. Closes https://github.com/flatpak/flatpak/issues/4928
This commit is contained in:
parent
26a546886a
commit
092421fabf
@ -1745,7 +1745,7 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Success: do not abort the transaction when returning. */
|
/* Success: do not abort the transaction when returning. */
|
||||||
txn->repo = NULL; (void) txn;
|
g_clear_object (&txn->repo); (void) txn;
|
||||||
|
|
||||||
if (out_transaction_resume)
|
if (out_transaction_resume)
|
||||||
*out_transaction_resume = ret_transaction_resume;
|
*out_transaction_resume = ret_transaction_resume;
|
||||||
|
Loading…
Reference in New Issue
Block a user