main: Ensure we always free context, loop and error

In case of early return we may not free them consistently, while this is not
a big problem in a main function, is better to have a cleaner management,
and we did get valgrind reports.
This commit is contained in:
Marco Trevisan (Treviño)
2020-01-28 19:02:40 +01:00
parent 580cceb50e
commit ee8589ec9d

View File

@ -140,9 +140,9 @@ static gboolean sigterm_callback(gpointer data)
int main(int argc, char **argv)
{
GOptionContext *context;
GMainLoop *loop;
GError *error = NULL;
g_autoptr(GOptionContext) context = NULL;
g_autoptr(GMainLoop) loop = NULL;
g_autoptr(GError) error = NULL;
FprintManager *manager;
DBusGProxy *driver_proxy;
guint32 request_name_ret;
@ -158,7 +158,6 @@ int main(int argc, char **argv)
if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
g_warning ("couldn't parse command-line options: %s\n", error->message);
g_error_free (error);
return 1;
}