[gnome-settings-daemon] keyboard: Fix leak when app info creation fails



commit 4012f0228bbf33327125e3f04d784a63b44fd065
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Apr 26 18:21:18 2012 +0100

    keyboard: Fix leak when app info creation fails
    
    g_app_info_create_from_commandline() fails, and we never free
    the error, so just don't use one.

 plugins/keyboard/gsd-keyboard-xkb.c |   30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)
---
diff --git a/plugins/keyboard/gsd-keyboard-xkb.c b/plugins/keyboard/gsd-keyboard-xkb.c
index 6d3387f..f820164 100644
--- a/plugins/keyboard/gsd-keyboard-xkb.c
+++ b/plugins/keyboard/gsd-keyboard-xkb.c
@@ -128,27 +128,21 @@ popup_menu_launch_capplet ()
 	GdkAppLaunchContext *ctx;
 	GError *error = NULL;
 
-	info =
-	    g_app_info_create_from_commandline
-	    ("gnome-control-center region", NULL, 0, &error);
-
-	if (info != NULL) {
-		ctx =
-		    gdk_display_get_app_launch_context
-		    (gdk_display_get_default ());
+	info = g_app_info_create_from_commandline ("gnome-control-center region", NULL, 0, NULL);
+	if (info == NULL)
+		return;
 
-		if (g_app_info_launch (info, NULL,
-				   G_APP_LAUNCH_CONTEXT (ctx), &error) == FALSE) {
-			g_warning
-				("Could not execute keyboard properties capplet: [%s]\n",
-				 error->message);
-			g_error_free (error);
-		}
+	ctx = gdk_display_get_app_launch_context (gdk_display_get_default ());
 
-		g_object_unref (info);
-		g_object_unref (ctx);
+	if (g_app_info_launch (info, NULL,
+			       G_APP_LAUNCH_CONTEXT (ctx), &error) == FALSE) {
+		g_warning ("Could not execute keyboard properties capplet: [%s]\n",
+			   error->message);
+		g_error_free (error);
 	}
 
+	g_object_unref (info);
+	g_object_unref (ctx);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]