[Spice-devel] [spice-gtk v1 07/10] file-transfer: avoid potential leaks
Victor Toso
victortoso at redhat.com
Fri Jul 29 22:26:28 UTC 2016
From: Christophe Fergeau <cfergeau at redhat.com>
---
src/spice-file-transfer-task.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/spice-file-transfer-task.c b/src/spice-file-transfer-task.c
index 667d230..ca1b51d 100644
--- a/src/spice-file-transfer-task.c
+++ b/src/spice-file-transfer-task.c
@@ -116,6 +116,8 @@ static void spice_file_transfer_task_query_info_cb(GObject *obj,
info = g_file_query_info_finish(G_FILE(obj), res, &error);
if (self->error) {
+ g_clear_object(&info);
+ g_clear_error(&error);
/* Return error previously reported */
g_task_return_error(task, self->error);
g_object_unref(task);
@@ -152,6 +154,7 @@ static void spice_file_transfer_task_read_file_cb(GObject *obj,
self->file_stream = g_file_read_finish(G_FILE(obj), res, &error);
if (self->error) {
+ g_clear_error(&error);
/* Return error previously reported */
self->pending = FALSE;
g_task_return_error(task, self->error);
@@ -190,6 +193,7 @@ static void spice_file_transfer_task_read_stream_cb(GObject *source_object,
nbytes = g_input_stream_read_finish(G_INPUT_STREAM(self->file_stream), res, &error);
if (self->error) {
+ g_clear_error(&error);
/* On any pending error on SpiceFileTransferTask */
g_task_return_error(task, self->error);
g_object_unref(task);
--
2.7.4
More information about the Spice-devel
mailing list