[gnome-builder] terminal: fix small leak in vte_get_user_shell() call



commit 7584ad9f96edb5b9ddbe35f59581a7db279eab15
Author: Christian Hergert <chergert redhat com>
Date:   Mon Sep 19 11:30:23 2016 -0700

    terminal: fix small leak in vte_get_user_shell() call
    
    We were leaking the shell we might fetch from vte_get_user_shell().

 plugins/terminal/gb-terminal-view.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index 5611fbd..3b18c8d 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -73,7 +73,7 @@ static void gb_terminal_view_connect_terminal (GbTerminalView *self,
 static void gb_terminal_respawn               (GbTerminalView *self,
                                                VteTerminal    *terminal);
 
-static const gchar *
+static gchar *
 gb_terminal_view_discover_shell (GCancellable  *cancellable,
                                  GError       **error)
 {
@@ -86,7 +86,7 @@ gb_terminal_view_discover_shell (GCancellable  *cancellable,
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
   if (cached_shell != NULL)
-    return cached_shell;
+    return g_strdup (cached_shell);
 
   command = g_strdup_printf ("sh -c 'cat /etc/passwd | grep ^%s: | cut -f 7 -d :'",
                              g_get_user_name ());
@@ -121,7 +121,7 @@ gb_terminal_view_discover_shell (GCancellable  *cancellable,
                          G_IO_ERROR_FAILED,
                          "Unknown error when discovering user shell");
 
-  return cached_shell;
+  return g_strdup (cached_shell);
 }
 
 static void
@@ -183,7 +183,7 @@ gb_terminal_respawn (GbTerminalView *self,
   g_autoptr(IdeSubprocess) subprocess = NULL;
   g_autoptr(IdeSubprocessLauncher) launcher = NULL;
   g_autofree gchar *workpath = NULL;
-  const gchar *shell;
+  g_autofree gchar *shell = NULL;
   GtkWidget *toplevel;
   GError *error = NULL;
   IdeContext *context;


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