[gnome-system-monitor] Free result of g_strdup_printf



commit d3ff1747043119806c51e586e3450fafc1bec15b
Author: Jack Leigh <jack leigh collabora com>
Date:   Fri Nov 15 11:29:09 2013 +0000

    Free result of g_strdup_printf
    
    https://bugzilla.gnome.org/show_bug.cgi?id=712360

 src/gsm_pkexec.cpp |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/gsm_pkexec.cpp b/src/gsm_pkexec.cpp
index 5328c30..22e3c94 100644
--- a/src/gsm_pkexec.cpp
+++ b/src/gsm_pkexec.cpp
@@ -7,17 +7,25 @@
 
 gboolean gsm_pkexec_create_root_password_dialog(const char *command)
 {
+    gboolean ret = FALSE;
     gint *exit_status = NULL;
     GError *error = NULL;
-    if (!g_spawn_command_line_sync( g_strdup_printf("pkexec %s/gsm-%s", GSM_LIBEXEC_DIR, command), NULL, 
NULL, exit_status, &error)) {
+    gchar *command_line = g_strdup_printf("pkexec %s/gsm-%s",
+                                          GSM_LIBEXEC_DIR, command);
+    if (!g_spawn_command_line_sync(command_line, NULL, NULL, exit_status, &error)) {
         g_critical("Could not run pkexec(\"%s\") : %s\n",
                    command, error->message);
         g_error_free(error);
-        return FALSE;
     }
+    else
+    {
+        g_message("pkexec did fine\n");
+        ret = TRUE;
+    }
+
+    g_free (command_line);
 
-    g_message("pkexec did fine\n");
-    return TRUE;
+    return ret;
 }
 
 


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