gio-tool: Do not leak GOptionContext

GOptionContext is freed only in case of success. Free the context
also in case of failure.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
This commit is contained in:
Ondrej Holy
2016-12-19 12:11:13 +01:00
parent 292f10d053
commit fb7d2184a6
16 changed files with 52 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ handle_open (int argc, char *argv[], gboolean do_help)
if (do_help)
{
show_help (context, NULL);
g_option_context_free (context);
return 0;
}
@@ -61,12 +62,14 @@ handle_open (int argc, char *argv[], gboolean do_help)
{
show_help (context, error->message);
g_error_free (error);
g_option_context_free (context);
return 1;
}
if (argc < 2)
{
show_help (context, _("No locations given"));
g_option_context_free (context);
return 1;
}