]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virnetserverclient: Remove Coverity DEADCODE warning
authorJohn Ferlan <jferlan@redhat.com>
Mon, 2 Dec 2013 19:47:09 +0000 (14:47 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 4 Dec 2013 11:27:19 +0000 (06:27 -0500)
The x509dname is only set inside a WITH_GNUTLS conditional, so
when used/check later on for NULL, Coverity detects this is not
possible.  Added WITH_GNUTLS around uses to remove message

src/rpc/virnetserverclient.c

index 0b9ab52fe185c71f653ad254acf70d60ea202cf9..8acf9147f3783efb2093e1d23231cad41d03ee0c 100644 (file)
@@ -658,7 +658,9 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
 #if WITH_SASL
     char *saslname = NULL;
 #endif
+#if WITH_GNUTLS
     char *x509dname = NULL;
+#endif
     char *seccontext = NULL;
     virIdentityPtr ret = NULL;
 
@@ -748,11 +750,13 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
                            saslname) < 0)
         goto error;
 #endif
+#if WITH_GNUTLS
     if (x509dname &&
         virIdentitySetAttr(ret,
                            VIR_IDENTITY_ATTR_X509_DISTINGUISHED_NAME,
                            x509dname) < 0)
         goto error;
+#endif
     if (seccontext &&
         virIdentitySetAttr(ret,
                            VIR_IDENTITY_ATTR_SELINUX_CONTEXT,
@@ -770,7 +774,9 @@ cleanup:
 #if HAVE_SASL
     VIR_FREE(saslname);
 #endif
+#if WITH_GNUTLS
     VIR_FREE(x509dname);
+#endif
     return ret;
 
 error: