builtins/commit: move commit modifier to auto-cleanup
authorLuca BRUNO <luca.bruno@coreos.com>
Wed, 18 Aug 2021 09:06:26 +0000 (09:06 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Wed, 18 Aug 2021 09:06:26 +0000 (09:06 +0000)
This reduces the usage of goto cleanup logic by porting the commit
modifier pointer to autoptr.

src/ostree/ot-builtin-commit.c

index 7a23741ee3a4c96d588f4c5d913ba2d385672e6b..2663bd1c87e2877b340da78052d1e1870890b3aa 100644 (file)
@@ -432,7 +432,7 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
   g_autoptr(GHashTable) skip_list = NULL;
   OstreeRepoCommitModifierFlags flags = 0;
   g_autoptr(OstreeSePolicy) policy = NULL;
-  OstreeRepoCommitModifier *modifier = NULL;
+  g_autoptr(OstreeRepoCommitModifier) modifier = NULL;
   OstreeRepoTransactionStats stats;
   struct CommitFilterData filter_data = { 0, };
   g_autofree char *commit_body = NULL;
@@ -968,7 +968,5 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio
  out:
   if (repo)
     ostree_repo_abort_transaction (repo, cancellable, NULL);
-  if (modifier)
-    ostree_repo_commit_modifier_unref (modifier);
   return ret;
 }