[virt-tools-list] [PATCH] Avoid 'Dereference of a null pointer'

Fabiano Fidêncio fidencio at redhat.com
Wed Mar 11 09:10:34 UTC 2015


Caught by Covscan.
---
 src/virt-viewer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index ec7d875..e4bca74 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -812,7 +812,7 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
         VirtViewerWindow *vwin = virt_viewer_app_get_main_window(VIRT_VIEWER_APP(app));
         GtkWindow *win = virt_viewer_window_get_window(vwin);
 
-        if (*username == NULL || **username == '\0')
+        if (username && (*username == NULL || **username == '\0'))
             *username = g_strdup(g_get_user_name());
 
         priv->auth_cancelled = !virt_viewer_auth_collect_credentials(win,
-- 
2.3.1




More information about the virt-tools-list mailing list