Skip to content

Commit

Permalink
main: Use g_autoptr for the GOptionContext
Browse files Browse the repository at this point in the history
No functional change, but it will make it easier to avoid leaking it.

Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv committed Feb 15, 2024
1 parent 28c0841 commit 07ad6af
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/flatpak-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ flatpak_run (int argc,

if (!command->fn)
{
GOptionContext *context;
g_autoptr(GOptionContext) context = NULL;
g_autofree char *hint = NULL;
g_autofree char *msg = NULL;

Expand Down Expand Up @@ -815,8 +815,6 @@ flatpak_run (int argc,
msg = g_strdup (_("No command specified"));
}

g_option_context_free (context);

g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "%s\n\n%s", msg, hint);

goto out;
Expand Down

0 comments on commit 07ad6af

Please sign in to comment.