[virt-tools-list] [virt-viewer] Fix 'title' leak in virt_viewer_file_fill_app()

Christophe Fergeau cfergeau at redhat.com
Thu Jun 5 09:38:09 UTC 2014


virt_viewer_file_get_title() returns a newly allocated string.
---
 src/virt-viewer-file.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
index 09f76b3..ae067f5 100644
--- a/src/virt-viewer-file.c
+++ b/src/virt-viewer-file.c
@@ -631,9 +631,11 @@ virt_viewer_file_fill_app(VirtViewerFile* self, VirtViewerApp *app, GError **err
         g_free(val);
     }
 
-    if (virt_viewer_file_is_set(self, "title"))
-        g_object_set(app, "title", virt_viewer_file_get_title(self), NULL);
-
+    if (virt_viewer_file_is_set(self, "title")) {
+        char *title = virt_viewer_file_get_title(self);
+        g_object_set(app, "title", title, NULL);
+        g_free(title);
+    }
 
     virt_viewer_app_clear_hotkeys(app);
 
-- 
1.9.3




More information about the virt-tools-list mailing list