[gnome-builder] command-bar: don't leak strings when building file path



commit 5be9a39af9de81c17afa9f4ccbdf3585ec29f069
Author: Matthew Leeds <mleeds redhat com>
Date:   Mon Feb 20 17:58:01 2017 -0600

    command-bar: don't leak strings when building file path

 plugins/command-bar/gb-vim.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/command-bar/gb-vim.c b/plugins/command-bar/gb-vim.c
index 4f5fdd7..caa2f12 100644
--- a/plugins/command-bar/gb-vim.c
+++ b/plugins/command-bar/gb-vim.c
@@ -592,10 +592,14 @@ gb_vim_command_vsplit (GtkWidget      *active_widget,
           return FALSE;
         }
 
-      file_path = g_strdup (options);
-
-      if (!g_path_is_absolute (file_path))
-        file_path = g_build_filename (g_file_get_path (workdir), file_path, NULL);
+      if (!g_path_is_absolute (options))
+        {
+          g_autofree gchar *workdir_path = NULL;
+          workdir_path = g_file_get_path (workdir);
+          file_path = g_build_filename (workdir_path, options, NULL);
+        }
+      else
+        file_path = g_strdup (options);
 
       file = g_file_new_for_path (file_path);
 


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