vnc: Drop superfluous conditionals around g_free()
authorMarkus Armbruster <armbru@redhat.com>
Fri, 6 Jun 2014 16:47:43 +0000 (18:47 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 19 Jun 2014 10:48:07 +0000 (12:48 +0200)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/vnc-tls.c
ui/vnc.c

index 50275de64f712b0038a9b3156eeb05e79973e1a9..63923265fd836bea1516be81a922ec955525332a 100644 (file)
@@ -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);
 
index 1684206184a22c5d9e1f0a69542e78b78a7aad31..d771a2cd4f6021ebd4e3769ea8080fe920015ed8 100644 (file)
--- 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);
     }