[Spice-commits] 2 commits - src/vmcstream.c

Fabiano Fidêncio fidencio at kemper.freedesktop.org
Fri Jul 29 12:31:21 UTC 2016

 src/vmcstream.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit cbf9da900caa2ac9be55eabd9f20ed4f23c7cee2
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Jul 27 12:50:41 2016 +0200

    vmc: Fix leak in spice_vmc_output_stream_write_finish()
    We own a reference on the GAsyncResult returned by
    g_task_propage_pointer() so we have to g_object_unref() it when we no
    longer need it.
    Acked-by: Fabiano Fidêncio <fidencio at redhat.com>

diff --git a/src/vmcstream.c b/src/vmcstream.c
index ffb1ba4..09a296b 100644
--- a/src/vmcstream.c
+++ b/src/vmcstream.c
@@ -399,9 +399,13 @@ spice_vmc_output_stream_write_finish(GOutputStream *stream,
     SpiceVmcOutputStream *self = SPICE_VMC_OUTPUT_STREAM(stream);
     GAsyncResult *res = g_task_propagate_pointer(G_TASK(simple), error);
+    gssize bytes_written;
     SPICE_DEBUG("spicevmc write finish");
-    return spice_vmc_write_finish(self->channel, res, error);
+    bytes_written = spice_vmc_write_finish(self->channel, res, error);
+    g_object_unref(res);
+    return bytes_written;
 static void
commit 9f91b03bc4c3c58e77169dfe71a8ec7525be5118
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Tue Jul 26 14:47:43 2016 +0200

    vmcstream: set the right result for the task
    This bogus code was introduced when switching to GTask API. Seems that
    while writing those patches I just overlooked this part and set the wrong
    result for the task. As part of the problems introduced (and now fixed)
    you can notice that no output stream was being sent to the guest.
    Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/src/vmcstream.c b/src/vmcstream.c
index c536f71..ffb1ba4 100644
--- a/src/vmcstream.c
+++ b/src/vmcstream.c
@@ -411,7 +411,7 @@ write_cb(GObject *source_object,
     GTask *task = user_data;
-    g_task_return_pointer(task, g_object_ref(task), g_object_unref);
+    g_task_return_pointer(task, g_object_ref(res), g_object_unref);

More information about the Spice-commits mailing list