summaryrefslogtreecommitdiff
path: root/src/ostree/ot-main.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2016-12-08 10:32:09 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2016-12-08 16:48:20 +0000
commitc19fae0282f52581665c62c74ab808b80382f301 (patch)
treeb19a35333e8d16db0a26ff46d55182b3fe52c556 /src/ostree/ot-main.c
parent5155662b57fe5943bba014c3035d87229f55ce54 (diff)
downloadostree-c19fae0282f52581665c62c74ab808b80382f301.tar.gz
tree-wide: Switch to autoptr for GOptionContext
We were leaking in a few places that I noticed in an ASAN run. Also, this was one of the last non-autoptr cleanup sections we have in `out:` cleanup sections, making us a lot closer to a potential full-tree rewrite to `return FALSE`. Closes: #624 Approved by: jlebon
Diffstat (limited to 'src/ostree/ot-main.c')
-rw-r--r--src/ostree/ot-main.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c
index 0d0587f2..fb782275 100644
--- a/src/ostree/ot-main.c
+++ b/src/ostree/ot-main.c
@@ -83,7 +83,7 @@ int
ostree_usage (OstreeCommand *commands,
gboolean is_error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
g_autofree char *help;
context = ostree_option_context_new_with_commands (commands);
@@ -97,8 +97,6 @@ ostree_usage (OstreeCommand *commands,
else
g_print ("%s", help);
- g_option_context_free (context);
-
return (is_error ? 1 : 0);
}
@@ -172,7 +170,7 @@ ostree_run (int argc,
if (!command->fn)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
g_autofree char *help;
context = ostree_option_context_new_with_commands (commands);
@@ -196,8 +194,6 @@ ostree_run (int argc,
help = g_option_context_get_help (context, FALSE, NULL);
g_printerr ("%s", help);
- g_option_context_free (context);
-
goto out;
}