summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2016-07-27 18:15:53 +0200
committerVictor Toso <victortoso@redhat.com>2016-08-03 15:27:50 +0200
commite1749021674518f54500c417d961576cf31ce51e (patch)
tree168888aac5b8026ad0cdf0b685cefb035ce19916
parentacda160767802f8d8ba07d591db3a2a566197472 (diff)
spicy: Fix spice_file_transfer_task_get_filename leak
It was wrongly annotated as (transfer none) An alternative would be to store what is returned by g_file_get_basename() in SpiceFileTransferTask and return that, this would allow to make spice_file_transfer_task_get_filename() (transfer none) without leaking memory. Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r--src/spice-file-transfer-task.c2
-rw-r--r--src/spicy.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/src/spice-file-transfer-task.c b/src/spice-file-transfer-task.c
index 219e980..2207ba4 100644
--- a/src/spice-file-transfer-task.c
+++ b/src/spice-file-transfer-task.c
@@ -535,7 +535,7 @@ void spice_file_transfer_task_cancel(SpiceFileTransferTask *self)
*
* Gets the name of the file being transferred in this task
*
- * Returns: (transfer none): The basename of the file
+ * Returns: (transfer full): The basename of the file
*
* Since: 0.31
**/
diff --git a/src/spicy.c b/src/spicy.c
index ea4d4e0..3cee7e5 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -1514,6 +1514,7 @@ task_cancel_cb(GtkButton *button,
static TransferTaskWidgets *
transfer_task_widgets_new(SpiceFileTransferTask *task)
{
+ char *filename;
TransferTaskWidgets *widgets = g_new0(TransferTaskWidgets, 1);
widgets->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
@@ -1521,7 +1522,9 @@ transfer_task_widgets_new(SpiceFileTransferTask *task)
widgets->cancel = gtk_button_new_with_label("Cancel");
widgets->progress = gtk_progress_bar_new();
- widgets->label = gtk_label_new(spice_file_transfer_task_get_filename(task));
+ filename = spice_file_transfer_task_get_filename(task);
+ widgets->label = gtk_label_new(filename);
+ g_free(filename);
gtk_widget_set_halign(widgets->label, GTK_ALIGN_START);
gtk_widget_set_valign(widgets->label, GTK_ALIGN_BASELINE);