From: John Ferlan Date: Wed, 27 Aug 2014 12:01:44 +0000 (-0400) Subject: domain_conf: Resolve Coverity REVERSE_INULL X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9ba04deca686d25223e66238d5e308e66c7c8cdf;p=libvirt.git domain_conf: Resolve Coverity REVERSE_INULL In virDomainActualNetDefFormat() a call to virDomainNetGetActualType(def) was made before a check for (!def) a few lines later. This triggered Coverity to note the possible NULL deref. Just moving the initialization to after the !def checks resolves the issue --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 91f92a4651..53733379cd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16211,11 +16211,13 @@ virDomainActualNetDefFormat(virBufferPtr buf, virDomainNetDefPtr def, unsigned int flags) { - unsigned int type = virDomainNetGetActualType(def); - const char *typeStr = virDomainNetTypeToString(type); + unsigned int type; + const char *typeStr; if (!def) return 0; + type = virDomainNetGetActualType(def); + typeStr = virDomainNetTypeToString(type); if (!typeStr) { virReportError(VIR_ERR_INTERNAL_ERROR,