[Spice-devel] [spice-gtk v1 01/10] test-file-transfer: Don't leak GFileInfo

Victor Toso victortoso at redhat.com
Fri Jul 29 22:26:22 UTC 2016


From: Christophe Fergeau <cfergeau at redhat.com>

The GFileInfo returned by spice_file_transfer_task_init_task_finish()
must be unref'ed when no longer needed.
---
 tests/file-transfer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/file-transfer.c b/tests/file-transfer.c
index d4d216d..4e00e9a 100644
--- a/tests/file-transfer.c
+++ b/tests/file-transfer.c
@@ -116,6 +116,7 @@ transfer_init_async_cb(GObject *obj, GAsyncResult *res, gpointer data)
     info = spice_file_transfer_task_init_task_finish(xfer_task, res, &error);
     g_assert_no_error(error);
     g_assert_nonnull(info);
+    g_object_unref(info);
 
     /* read file loop */
     spice_file_transfer_task_read_async(xfer_task, transfer_read_async_cb, NULL);
@@ -223,6 +224,7 @@ transfer_on_init_async_cb_before_read_cancel(GObject *obj, GAsyncResult *res, gp
     info = spice_file_transfer_task_init_task_finish(xfer_task, res, &error);
     g_assert_no_error(error);
     g_assert_nonnull(info);
+    g_object_unref(info);
 
     cancellable = spice_file_transfer_task_get_cancellable(xfer_task);
     g_cancellable_cancel(cancellable);
@@ -241,6 +243,7 @@ transfer_on_init_async_cb_after_read_cancel(GObject *obj, GAsyncResult *res, gpo
     info = spice_file_transfer_task_init_task_finish(xfer_task, res, &error);
     g_assert_no_error(error);
     g_assert_nonnull(info);
+    g_object_unref(info);
 
     cancellable = spice_file_transfer_task_get_cancellable(xfer_task);
     spice_file_transfer_task_read_async(xfer_task, transfer_cancelled_read_async_cb, data);
@@ -313,6 +316,7 @@ transfer_on_init_async_cb_agent_cancel(GObject *obj, GAsyncResult *res, gpointer
     info = spice_file_transfer_task_init_task_finish(xfer_task, res, &error);
     g_assert_no_error(error);
     g_assert_nonnull(info);
+    g_object_unref(info);
 
     spice_file_transfer_task_read_async(xfer_task, transfer_agent_cancelled_read_async_cb, data);
 
-- 
2.7.4



More information about the Spice-devel mailing list