From 64641d876466333b833e8a188a46e2e06c008bac Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 6 Jun 2014 18:47:43 +0200 Subject: [PATCH 1/3] vnc: Drop superfluous conditionals around g_free() Signed-off-by: Markus Armbruster Signed-off-by: Gerd Hoffmann --- ui/vnc-tls.c | 6 ++---- ui/vnc.c | 12 ++++-------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c index 50275de64f..63923265fd 100644 --- a/ui/vnc-tls.c +++ b/ui/vnc-tls.c @@ -443,10 +443,8 @@ static int vnc_set_x509_credential(VncDisplay *vd, { struct stat sb; - if (*cred) { - g_free(*cred); - *cred = NULL; - } + g_free(*cred); + *cred = NULL; *cred = g_malloc(strlen(certdir) + strlen(filename) + 2); diff --git a/ui/vnc.c b/ui/vnc.c index 1684206184..d771a2cd4f 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2972,10 +2972,8 @@ static void vnc_display_close(DisplayState *ds) if (!vs) return; - if (vs->display) { - g_free(vs->display); - vs->display = NULL; - } + g_free(vs->display); + vs->display = NULL; if (vs->lsock != -1) { qemu_set_fd_handler2(vs->lsock, NULL, NULL, NULL, NULL); close(vs->lsock); @@ -3010,10 +3008,8 @@ int vnc_display_password(DisplayState *ds, const char *password) return -EINVAL; } - if (vs->password) { - g_free(vs->password); - vs->password = NULL; - } + g_free(vs->password); + vs->password = NULL; if (password) { vs->password = g_strdup(password); } From c14e98479bd3cb3667e283e815c238135db2edc1 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 6 Jun 2014 18:47:44 +0200 Subject: [PATCH 2/3] vnc: Drop superfluous conditionals around g_strdup() Signed-off-by: Markus Armbruster Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index d771a2cd4f..6c9d4f3492 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3009,10 +3009,7 @@ int vnc_display_password(DisplayState *ds, const char *password) } g_free(vs->password); - vs->password = NULL; - if (password) { - vs->password = g_strdup(password); - } + vs->password = g_strdup(password); return 0; } From eb214ff8ef6cceec348f3ad1643b39443fe07910 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 13 Jun 2014 10:23:10 +0200 Subject: [PATCH 3/3] vnc: fix screen updates Bug was added by 38ee14f4f33f8836fc0e209ca59c6ae8c6edf380. vnc_jobs_join call is missing in one code path. Reported-by: Anthony PERARD Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/vnc.c b/ui/vnc.c index 6c9d4f3492..aac93f0e17 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -935,6 +935,9 @@ static int vnc_update_client(VncState *vs, int has_dirty, bool sync) } vnc_job_push(job); + if (sync) { + vnc_jobs_join(vs); + } vs->force_update = 0; return n; }