Declare VirtViewerFile variable at start of method

virt_viewer_session_vnc_auth_credential uses gotos which jump over the
declaration of 'file', meaning its contents are uninitialized in the
jump target.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-02-12 14:23:12 +00:00
parent 9e4cc377a5
commit 5daeea567c

View File

@ -273,6 +273,7 @@ virt_viewer_session_vnc_auth_credential(GtkWidget *src G_GNUC_UNUSED,
VirtViewerSessionVnc *self = VIRT_VIEWER_SESSION_VNC(session);
char *username = NULL, *password = NULL;
gboolean wantPassword = FALSE, wantUsername = FALSE;
VirtViewerFile *file = NULL;
int i;
g_debug("Got VNC credential request for %u credential(s)", credList->n_values);
@ -295,7 +296,7 @@ virt_viewer_session_vnc_auth_credential(GtkWidget *src G_GNUC_UNUSED,
}
}
VirtViewerFile *file = virt_viewer_session_get_file(VIRT_VIEWER_SESSION(self));
file = virt_viewer_session_get_file(VIRT_VIEWER_SESSION(self));
if (file != NULL) {
if (wantUsername) {
if (virt_viewer_file_is_set(file, "username")) {