[gnome-builder] git: consistently use g_steal_pointer() for errors



commit ac0ec45dea41cb4ee30d4cbc4195859a73046a74
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 18 14:23:00 2017 -0700

    git: consistently use g_steal_pointer() for errors
    
    This fixes a double free that can happen because we failed to
    steal the pointer when changing to g_autoptr(GError).

 src/plugins/git/ide-git-vcs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/git/ide-git-vcs.c b/src/plugins/git/ide-git-vcs.c
index 370fb3a..114f152 100644
--- a/src/plugins/git/ide-git-vcs.c
+++ b/src/plugins/git/ide-git-vcs.c
@@ -365,7 +365,7 @@ ide_git_vcs_reload_worker (GTask        *task,
       !(repository2 = ide_git_vcs_load (self, &error)))
     {
       g_debug ("%s", error->message);
-      g_task_return_error (task, error);
+      g_task_return_error (task, g_steal_pointer (&error));
       IDE_EXIT;
     }
 
@@ -627,13 +627,13 @@ ide_git_vcs_init_async__reload_cb (GObject      *object,
 {
   IdeGitVcs *self = (IdeGitVcs *)object;
   g_autoptr(GTask) task = user_data;
-  GError *error = NULL;
+  g_autoptr(GError) error = NULL;
 
   g_assert (G_IS_TASK (task));
   g_assert (IDE_IS_GIT_VCS (self));
 
   if (!ide_git_vcs_reload_finish (self, result, &error))
-    g_task_return_error (task, error);
+    g_task_return_error (task, g_steal_pointer (&error));
   else
     g_task_return_boolean (task, TRUE);
 }


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