From edc00728ab933ed397ebb391a3c23de9cd9fc22e Mon Sep 17 00:00:00 2001 From: Christopher Aillon Date: Tue, 5 Jun 2007 22:45:42 +0000 Subject: [PATCH] 2007-06-05 Christopher Aillon Patch from Christian Persch * auth-dialog/main.c: * auth-dialog-general/main.c: Stop leaking GnomeProgram objects. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2576 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- vpn-daemons/pptp/ChangeLog | 8 ++++++++ vpn-daemons/pptp/auth-dialog-general/main.c | 17 +++++++++-------- vpn-daemons/pptp/auth-dialog/main.c | 17 +++++++++-------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/vpn-daemons/pptp/ChangeLog b/vpn-daemons/pptp/ChangeLog index 73e46c4c67..efc56e7de1 100644 --- a/vpn-daemons/pptp/ChangeLog +++ b/vpn-daemons/pptp/ChangeLog @@ -1,3 +1,11 @@ +2007-06-05 Christopher Aillon + + Patch from Christian Persch + + * auth-dialog/main.c: + * auth-dialog-general/main.c: + Stop leaking GnomeProgram objects. + 2007-02-02 Dan Williams * src/nm-ppp-starter.c diff --git a/vpn-daemons/pptp/auth-dialog-general/main.c b/vpn-daemons/pptp/auth-dialog-general/main.c index 112b171d49..2820f0918e 100644 --- a/vpn-daemons/pptp/auth-dialog-general/main.c +++ b/vpn-daemons/pptp/auth-dialog-general/main.c @@ -107,7 +107,8 @@ main (int argc, char *argv[]) static gchar *service_name = NULL; GError *error = NULL; GOptionContext *context; - static GOptionEntry entries[] = + GnomeProgram *program; + GOptionEntry entries[] = { { "reprompt", 'r', 0, G_OPTION_ARG_NONE, &retry, "Reprompt for passwords", NULL}, { "name", 'n', 0, G_OPTION_ARG_STRING, &connection_name, "Name of connection", NULL}, @@ -125,9 +126,13 @@ main (int argc, char *argv[]) context = g_option_context_new ("- ppp auth dialog"); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); - g_option_context_add_group (context, gtk_get_option_group (TRUE)); - g_option_context_parse (context, &argc, &argv, &error); + program = gnome_program_init ("nm-ppp-auth-dialog", VERSION, + LIBGNOMEUI_MODULE, + argc, argv, + GNOME_PARAM_GOPTION_CONTEXT, context, + GNOME_PARAM_NONE); + if (connection_name == NULL || service_name == NULL) { fprintf (stderr, "Have to supply both name and service\n"); goto out; @@ -138,10 +143,6 @@ main (int argc, char *argv[]) goto out; } - gnome_program_init ("nm-ppp-auth-dialog", VERSION, LIBGNOMEUI_MODULE, - argc, argv, - GNOME_PARAM_NONE); - passwords = get_passwords (connection_name, service_name, retry); if (passwords == NULL) goto out; @@ -162,7 +163,7 @@ main (int argc, char *argv[]) fread (buf, sizeof (char), sizeof (buf), stdin); out: - g_option_context_free (context); + g_object_unref (program); return passwords != NULL ? 0 : 1; } diff --git a/vpn-daemons/pptp/auth-dialog/main.c b/vpn-daemons/pptp/auth-dialog/main.c index 5be4dc5da7..4a5aa96aad 100644 --- a/vpn-daemons/pptp/auth-dialog/main.c +++ b/vpn-daemons/pptp/auth-dialog/main.c @@ -214,7 +214,8 @@ main (int argc, char *argv[]) static gchar *vpn_service = NULL; GError *error = NULL; GOptionContext *context; - static GOptionEntry entries[] = + GnomeProgram *program; + GOptionEntry entries[] = { { "reprompt", 'r', 0, G_OPTION_ARG_NONE, &retry, "Reprompt for passwords", NULL}, { "name", 'n', 0, G_OPTION_ARG_STRING, &vpn_name, "Name of VPN connection", NULL}, @@ -231,9 +232,13 @@ main (int argc, char *argv[]) context = g_option_context_new ("- ppp auth dialog"); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); - g_option_context_add_group (context, gtk_get_option_group (TRUE)); - g_option_context_parse (context, &argc, &argv, &error); + program = gnome_program_init ("nm-ppp-auth-dialog", VERSION, + LIBGNOMEUI_MODULE, + argc, argv, + GNOME_PARAM_GOPTION_CONTEXT, context, + GNOME_PARAM_NONE); + if (vpn_name == NULL || vpn_service == NULL) { fprintf (stderr, "Have to supply both name and service\n"); goto out; @@ -244,10 +249,6 @@ main (int argc, char *argv[]) goto out; } - gnome_program_init ("nm-ppp-auth-dialog", VERSION, LIBGNOMEUI_MODULE, - argc, argv, - GNOME_PARAM_NONE); - passwords = get_passwords (vpn_name, vpn_service, retry); if (passwords == NULL) goto out; @@ -268,7 +269,7 @@ main (int argc, char *argv[]) fread (buf, sizeof (char), sizeof (buf), stdin); out: - g_option_context_free (context); + g_object_unref (program); return passwords != NULL ? 0 : 1; }