[virt-tools-list] [remote-viewer PATCH 3/7 v3] remote-viewer-connect: Check if uri is NULL
Lukas Venhoda
lvenhoda at redhat.com
Mon Jun 15 10:47:30 UTC 2015
URI should be NULL before passing it to remote_viewer_connect_dialog.
---
Changes since v2
- Check for NULL instead of free
Changes since v1
- New patch
- Free uri before using it. Just to be sure
---
src/remote-viewer-connect.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/remote-viewer-connect.c b/src/remote-viewer-connect.c
index 5c3b03f..a4bce27 100644
--- a/src/remote-viewer-connect.c
+++ b/src/remote-viewer-connect.c
@@ -97,7 +97,7 @@ make_label_bold(GtkLabel* label)
* @brief Opens connect dialog for remote viewer
*
* @param main_window Parent window of the dialog
-* @param uri For returning the uri of chosen server
+* @param uri For returning the uri of chosen server, must be NULL
*
* @return TRUE if Connect or ENTER is pressed
* @return FALSE if Cancel is pressed or dialog is closed
@@ -112,6 +112,8 @@ remote_viewer_connect_dialog(GtkWindow *main_window, gchar **uri)
GtkRecentFilter *rfilter;
gboolean retval;
+ g_return_val_if_fail(uri && *uri == NULL, FALSE);
+
/* Create the widgets */
dialog = gtk_dialog_new_with_buttons(_("Connection details"),
main_window,
--
2.4.2
More information about the virt-tools-list
mailing list