[gnome-builder] sysroot: fix memory leak when getting additional pkgconfig paths



commit f808aa162eebd938c8934473cf67009ab7275764
Author: Corentin Noël <corentin noel collabora co uk>
Date:   Thu May 17 16:02:47 2018 +0100

    sysroot: fix memory leak when getting additional pkgconfig paths

 src/plugins/sysroot/gbp-sysroot-manager.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/sysroot/gbp-sysroot-manager.c b/src/plugins/sysroot/gbp-sysroot-manager.c
index c7b3fa9cd..61e11b140 100644
--- a/src/plugins/sysroot/gbp-sysroot-manager.c
+++ b/src/plugins/sysroot/gbp-sysroot-manager.c
@@ -82,10 +82,13 @@ sysroot_manager_find_additional_pkgconfig_paths (GbpSysrootManager *self,
   libmultiarch_path = g_build_filename (path, "usr", "lib", target_arch, "pkgconfig", NULL);
 
   if (g_file_test (lib64_path, G_FILE_TEST_EXISTS))
-    returned_paths = lib64_path;
+    returned_paths = g_steal_pointer (&lib64_path);
 
   if (g_file_test (libmultiarch_path, G_FILE_TEST_EXISTS))
-    returned_paths = g_strjoin (":", libmultiarch_path, returned_paths, NULL);
+    {
+      g_autofree gchar *previous_returned_path = g_steal_pointer (&returned_paths);
+      returned_paths = g_strjoin (":", libmultiarch_path, previous_returned_path, NULL);
+    }
 
   return g_strdup (returned_paths);
 }


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