virnetserverclient: Remove Coverity DEADCODE warning

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
This commit is contained in:
John Ferlan 2013-12-02 14:47:09 -05:00
parent 5a298ec040
commit 643b5f843d

View File

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