[virt-tools-list] [remote-viewer PATCH 3/7 v2] remote-viewer-connect: Free uri before writing to it

Lukas Venhoda lvenhoda at redhat.com
Thu Jun 11 14:28:38 UTC 2015


Before writing the connection address to uri, g_free() it.
Not freeing wouldn't cause an issue now, because uri is always NULL, but
this could change in the future.
---
Changes since v1
 - New patch
 - Free uri before using it. Just to be sure
---
 src/remote-viewer-connect.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/remote-viewer-connect.c b/src/remote-viewer-connect.c
index 3927d19..6cfb7b1 100644
--- a/src/remote-viewer-connect.c
+++ b/src/remote-viewer-connect.c
@@ -178,6 +178,8 @@ remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri)
     /* show and wait for response */
     gtk_widget_show_all(dialog);

+    g_free(*uri);
+
     if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
         *uri = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
         g_strstrip(*uri);
--
2.4.2




More information about the virt-tools-list mailing list