[gnome-builder] git: fix known leaks in test-git.c



commit 55282952684089e8d9c3e6ca9637a6c89e9534e1
Author: Christian Hergert <chergert redhat com>
Date:   Thu May 6 13:15:16 2021 -0700

    git: fix known leaks in test-git.c

 src/plugins/git/daemon/test-git.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/git/daemon/test-git.c b/src/plugins/git/daemon/test-git.c
index a8642cfd7..8200534fc 100644
--- a/src/plugins/git/daemon/test-git.c
+++ b/src/plugins/git/daemon/test-git.c
@@ -126,6 +126,7 @@ test_push (IpcGitService    *service,
 {
   g_autofree gchar *location = NULL;
   g_autofree gchar *url = NULL;
+  g_autofree gchar *dir = NULL;
   g_autoptr(GError) error = NULL;
   static const gchar *ref_names[] = { "refs/heads/master:refs/heads/master", NULL };
   IpcGitPushFlags flags = IPC_GIT_PUSH_FLAGS_NONE;
@@ -137,7 +138,8 @@ test_push (IpcGitService    *service,
   g_assert_true (ret);
   g_message ("Bare repository created at %s", location);
 
-  url = g_strdup_printf ("file://%s/%s", g_get_current_dir (), tmpdir_push);
+  dir = g_get_current_dir ();
+  url = g_strdup_printf ("file://%s/%s", dir, tmpdir_push);
 
   g_message ("Pushing to %s", url);
   ret = ipc_git_repository_call_push_sync (repository, url, ref_names, flags, PROGRESS_PATH, NULL, &error);
@@ -158,7 +160,7 @@ create_commit_details (const gchar *commit_msg)
   g_variant_dict_insert (&dict, "COMMITTER_EMAIL", "s", "me@localhost");
   g_variant_dict_insert (&dict, "COMMIT_MSG", "s", commit_msg ?: "");
 
-  return g_variant_take_ref (g_variant_dict_end (&dict));
+  return g_variant_dict_end (&dict);
 }
 
 static void
@@ -170,7 +172,6 @@ test_clone (IpcGitService *service)
   g_autoptr(IpcGitConfig) config = NULL;
   g_autoptr(GError) error = NULL;
   g_autoptr(GVariant) files = NULL;
-  g_autoptr(GVariant) details = NULL;
   g_autofree gchar *testfile = NULL;
   g_autofree gchar *location = NULL;
   g_autofree gchar *obj_path = NULL;
@@ -180,6 +181,7 @@ test_clone (IpcGitService *service)
   g_autoptr(GVariant) changes = NULL;
   g_autofree gchar *monitor_path = NULL;
   GVariantDict opts;
+  GVariant *details;
   GDBusConnection *conn;
   GVariantIter iter;
   gboolean ret;


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